mcmuney Posted August 25, 2011 Share Posted August 25, 2011 What's wrong with this statement? $mansql="SELECT mov.*, avg.* FROM sc_movies mov LEFT JOIN sc_movies_rate_avg avg ON mov.mov_id=avg.scm_mem_id WHERE (SELECT id_mov FROM sc_movies_comments)=mov.mov_id ORDER BY (SELECT add_date FROM sc_movies_comments) DESC"; Quote Link to comment https://forums.phpfreaks.com/topic/245661-whats-wrong-with-this-statement/ Share on other sites More sharing options...
MasterACE14 Posted August 25, 2011 Share Posted August 25, 2011 $mansql="SELECT mov.*, avg.* FROM sc_movies mov LEFT JOIN sc_movies_rate_avg avg ON mov.mov_id=avg.scm_mem_id WHERE (SELECT id_mov FROM sc_movies_comments)=mov.mov_id ORDER BY (SELECT add_date FROM sc_movies_comments) DESC"; mysql_query($mansql) or die(mysql_error()); and find out... Quote Link to comment https://forums.phpfreaks.com/topic/245661-whats-wrong-with-this-statement/#findComment-1261714 Share on other sites More sharing options...
mcmuney Posted August 25, 2011 Author Share Posted August 25, 2011 There's no error, but no results are produced. Quote Link to comment https://forums.phpfreaks.com/topic/245661-whats-wrong-with-this-statement/#findComment-1261716 Share on other sites More sharing options...
MasterACE14 Posted August 25, 2011 Share Posted August 25, 2011 is there data in the tables? Quote Link to comment https://forums.phpfreaks.com/topic/245661-whats-wrong-with-this-statement/#findComment-1261718 Share on other sites More sharing options...
mcmuney Posted August 25, 2011 Author Share Posted August 25, 2011 Yes, there's data. Quote Link to comment https://forums.phpfreaks.com/topic/245661-whats-wrong-with-this-statement/#findComment-1261720 Share on other sites More sharing options...
MasterACE14 Posted August 25, 2011 Share Posted August 25, 2011 try this: $mansql="SELECT mov.*, avg.* FROM mov.sc_movies LEFT JOIN avg.sc_movies_rate_avg ON mov.mov_id=avg.scm_mem_id WHERE (SELECT avg.id_mov FROM avg.sc_movies_comments)=mov.mov_id ORDER BY (SELECT avg.add_date FROM avg.sc_movies_comments) DESC"; Quote Link to comment https://forums.phpfreaks.com/topic/245661-whats-wrong-with-this-statement/#findComment-1261722 Share on other sites More sharing options...
mcmuney Posted August 25, 2011 Author Share Posted August 25, 2011 Didn't work. "avg" is already being referenced as another table, why would that be used again? Quote Link to comment https://forums.phpfreaks.com/topic/245661-whats-wrong-with-this-statement/#findComment-1261724 Share on other sites More sharing options...
MasterACE14 Posted August 25, 2011 Share Posted August 25, 2011 Sorry, I'm not familiar with your database structure. It's definitely not a PHP issue? Have you tried running the query in PHPMyAdmin or something similar? Quote Link to comment https://forums.phpfreaks.com/topic/245661-whats-wrong-with-this-statement/#findComment-1261731 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.