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. Quote 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 :) Quote Link to comment https://forums.phpfreaks.com/topic/23488-simple-sql-question/#findComment-106667 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.