What is the correct syntax to combine these two queries?
SELECT clicks FROM clicksTable WHERE clicks > 199 ORDER BY clicks ASC LIMIT 1
and
SELECT clicks FROM clicksTable ORDER BY clicks DESC LIMIT 1
I tried:
SELECT clicks FROM clicksTable WHERE clicks > 199 ORDER BY clicks ASC LIMIT 1 UNION SELECT clicks FROM clicksTable ORDER BY clicks DESC LIMIT 1;
but I get "Misuse of UNION and ORDER BY".
EDIT In addition, I want the result to be returned on a single line. So that I can access the value in php like
$row['nextclick'] and $row['topclick']
From Simon’s suggestion I shouldn’t use UNION because I want to return one row of data
source share