waynew Posted July 10, 2008 Share Posted July 10, 2008 I keep getting 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 id FROM jobs WHERE status = 1 AND MONTH(reg_date) = '10'' at line 2 $i=0; //reset counter while($i < sizeof($x_months)){ $profit_result[$i] = mysql_query("SELECT SUM(tender_price) FROM tenders WHERE job_id = SELECT id FROM jobs WHERE status = 1 AND MONTH(reg_date) = '$months_timeline[$i]'") or die(mysql_error()); $i++; } What's wrong????! Quote Link to comment Share on other sites More sharing options...
atticus Posted July 10, 2008 Share Posted July 10, 2008 Have you tried running the sub query in parenthesis? Quote Link to comment Share on other sites More sharing options...
atticus Posted July 10, 2008 Share Posted July 10, 2008 Have you tried running the sub query in parenthesis? SELECT SUM(tender_price) FROM tenders WHERE job_id = (SELECT id FROM jobs WHERE status = 1 AND MONTH(reg_date) = '$months_timeline[$i]') 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.