Hey guys I have a SQL statement here that seems like it should work but it isn't. MySQL just returns an ambiguous Error that says "You have an error in your SQL statement".
I am trying to join 2 tables and return all the rows where a field in table1 is less than a field in table2.
For instance:
$sql="SELECT j.*,t.* FROM tblTasks AS t
LEFT JOIN tblJobs AS j ON j.JobID = t.JobID
WHERE t.BodyTech = '$techID' AND j.BodyHours < t.BodyPaid
(OR t.PDRTech = '$techID' AND j.LAU < t.PDRPaid)
(OR t.GlassTech = '$techID' AND j.GlassHours < t.GlassPaid)
AND t.AccountID = '$accountID' AND j.AccountID = '$accountID'";
Is not possible to do what I am trying to do or is there some simple syntax error in the SQL statement?
Thanks!🙂