I am running this query on MySQL and it is giving this error:
Every derived table must have its own alias.
SELECT MAX (mycount) FROM
(SELECT CreatedBy,COUNT(CreatedBy) mycount
FROM audit_csp_evaluation
GROUP BY CreatedBy);
I am running this query on MySQL and it is giving this error:
Every derived table must have its own alias.
SELECT MAX (mycount) FROM
(SELECT CreatedBy,COUNT(CreatedBy) mycount
FROM audit_csp_evaluation
GROUP BY CreatedBy);
You have to name the derived table, like this:
SELECT MAX(x.mycount) AS max_mycount
FROM
(
SELECT CreatedBy
, COUNT(CreatedBy) AS mycount
FROM audit_csp_evaluation
GROUP BY CreatedBy
) x;
x is the name I'm giving the derived table.
You need to give a name to the table derived from your subquery.
SELECT MAX(c.mycount) FROM
(
SELECT CreatedBy,COUNT(CreatedBy) mycount
FROM audit_csp_evaluation
GROUP BY CreatedBy
)c <---added name here;