Hello... In MySQL, this portion of code works and produces a single row of '1' as value.
SELECT DISTINCT 1 AS score
ORDER BY score DESC;
However, when I use it with creating temporary tables as in the one below:
DROP TEMPORARY TABLE IF EXISTS `testTable`;
CREATE TEMPORARY TABLE `testTable`
SELECT DISTINCT 1 AS score
ORDER BY score DESC;
MySQL would say: 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 'order by score desc' at line 3
Note that the code below works... the one without ORDER BY
DROP TEMPORARY TABLE IF EXISTS `testTable`;
CREATE TEMPORARY TABLE `testTable`
SELECT DISTINCT 1 AS score;
Appending it with a FROM clause as shown below, would work...
DROP TEMPORARY TABLE IF EXISTS `testTable`;
CREATE TEMPORARY TABLE `testTable`
SELECT DISTINCT 1 AS score
FROM tableX
ORDER BY score DESC;
I know that my sample above is not significant, but this is more of a curiosity question. Thanks.