I have the following sql statement in my code:
SELECT country, count(*) as hits WHERE website=? from a GROUP BY country ORDER BY hits DESC
When I run this, it seems to fail. What is wrong with this? Where should I place the WHERE statement?
I have the following sql statement in my code:
SELECT country, count(*) as hits WHERE website=? from a GROUP BY country ORDER BY hits DESC
When I run this, it seems to fail. What is wrong with this? Where should I place the WHERE statement?
The order of clause is fixed in SQL. For the ones you are using:
SELECTFROMWHEREGROUP BYORDER BYThis is the language. So you want:
SELECT country, count(*) as hits 
FROM a
WHERE website = ? 
GROUP BY country
ORDER BY hits DESC
 
    
      SELECT country, count(*) as hits 
  FROM a  
  WHERE website=? 
  GROUP BY country 
  ORDER BY hits DESC
This query will work after providing Where filter condition
