Omabala Posted October 10, 2006 Share Posted October 10, 2006 Could someone please tell me how to retrieve a table so that one column simply displays something and another column counts somethingfor example:SELECT COUNT(u_id), SELECT countryName FROM _AEsurvey_regoWHERE countryName LIKE ('China')GROUP BY countryName;but I get this error message:#1064 - 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 'SELECT countryName FROM _AEsurvey_rego WHERE countryName LIKE ( 'China' ) GRO' at line 1Cheers. Link to comment https://forums.phpfreaks.com/topic/23488-simple-sql-question/ Share on other sites More sharing options...
btherl Posted October 10, 2006 Share Posted October 10, 2006 SELECT countryName, COUNT(u_id)FROM _AEsurvey_regoWHERE countryName LIKE 'China'GROUP BY countryName;This ought to work.. I'm a bit confused as your query and error message do not match up.Or maybe they do match up, and mysql removes the second select. In any case, you only need to say "select" once :) Link to comment https://forums.phpfreaks.com/topic/23488-simple-sql-question/#findComment-106667 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.