Omabala Posted October 10, 2006 Share Posted October 10, 2006 Im trying to retrieve information from 3 different tables and end up with a table with 5 columns:1st column displays vis_type2nd column displays countryName3rd column displays the total number of u_id4th column displays average score of aesth_rankand 5th column displays average score of x_posMySQL keeps telling me something is wrong with my 2nd line...it seems to not like how i type SELECT COUNT (...)Can any1 tell me all the errors in my query...I'm just a beginnerSELECT a.vis_type, c.countryName AND SELECT COUNT (‘a.u_id’) AND SELECT AVG(‘a.aesth_rank’) AND SELECT AVG(‘b.x_pos’) FROM _AEsurvey_meta_info a, _AEsurvey_aesth_rank b, _AEsurvey_rego c WHERE (a.vis_type = '1' AND c.countryName LIKE ('China'))OR (a.vis_type=’2’ AND c.countryName LIKE (‘China’))AND a.u_id = b.u_idAND b.u_id = c.u_idGROUP BY a.vis_type;Thanks. Quote Link to comment Share on other sites More sharing options...
btherl Posted October 10, 2006 Share Posted October 10, 2006 There's certainly something odd with the quotes. In general, you don't need to put any quotes around column names.[code]SELECT a.vis_type, c.countryName, count(a.u_id) AS a_u_id_count, ...[/code]This style should work. Quote Link to comment Share on other sites More sharing options...
Vikas Jayna Posted October 10, 2006 Share Posted October 10, 2006 Firstly, the word 'SELECT' is to be used only once and all the columns to be displayed have to be comma separated instead of 'AND' and then the column names are not to have quotes Quote Link to comment 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.