A sql query didn't work in old version of mysql below 8:
SELECT count(*) OVER() AS d FROM `T`
It gives this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() AS FULLCOUNT FROM T' at line 1
You can refer to this DBFiddle:
https://dbfiddle.uk/?rdbms=mysql_5.7&fiddle=7dd651e5b2c988a7a85c76a2c83df066
to test the query with different versions.
then tell me how can I solve that issue without upgrade mysql version because I don't have access of that server
CodePudding user response:
This way :
SELECT (select COUNT(*) as d FROM T) as d
FROM T;