1

I keep getting this error and I have an alias declared? Any help would be appreciated.

CREATE VIEW maxJokes AS 
SELECT MAX(num) FROM 
( SELECT J.postUserID, count(*) AS num 
  FROM JokeTable J WHERE J.date >= '2018-03-01' 
  GROUP BY J.postUserID
)
Jens
  • 67,715
  • 15
  • 98
  • 113
Salwa Badreddine
  • 125
  • 2
  • 11
  • 1
    Possible duplicate of [What is the error "Every derived table must have its own alias" in MySQL?](https://stackoverflow.com/questions/1888779/what-is-the-error-every-derived-table-must-have-its-own-alias-in-mysql) – Nick Apr 04 '19 at 05:20

1 Answers1

2

you've to add a alias name in the subquery

CREATE VIEW maxJokes AS 

SELECT MAX(num) FROM 
( 
   SELECT J.postUserID, count(*) AS num 
   FROM JokeTable J WHERE J.date >= '2018-03-01'
   GROUP BY J.postUserID
)A
Fahmi
  • 37,315
  • 5
  • 22
  • 31