0

I am getting a syntax error (near as) on line 22 which is

 CREATE VIEW myDat 
 AS
     SELECT count(*) AS count
     FROM disco l
     GROUP BY l.no;

22   SELECT * as no
     FROM myDat
     WHERE count > (SELECT avg(count) FROM myDat);

I can't seem to figure out what I am doing wrong. I am assuming its the nested SELECT statement in the last line? I looked at the SQLite documentation and it seems be correct. But any other reason for errors?

2
  • 1
    You can not alias *. * indicates all columns. Commented Nov 24, 2015 at 0:00
  • What is the error message, and what isall the code? Commented Nov 24, 2015 at 0:35

2 Answers 2

2

Change query to remove alias or set alias as below:

SELECT count as no
FROM myDat
WHERE count > (SELECT avg(count) FROM myDat);
Sign up to request clarification or add additional context in comments.

Comments

0

You can't alias asterisk. You must remove alias, or replace asterisk by the column name count.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.