php - Sum of left join tables -
i have 3 tables in mysql database. jobrequest- jobno, vehicleno labour- date, jobno4, amount2 materialcost date, jobno2, amount3 when user select jobno jobrequest table, want display total of labourcost , materialcost..... here code
$result = mysql_query(" select jobrequest.jobno,jobrequest.vehicleno, sum(amount2) amount2, sum(amount3) amount3, jobrequest left join materialcost on jobrequest.jobno = materialused.jobno2 left join labour on jobrequest.jobno = labour.jobno4 ( jobrequest.jobno = '$item1') ");
select jobrequest.jobno, jobrequest.vehicleno, sum(amount2) amount2, sum(amount3) amount3 jobrequest left join materialcost on jobrequest.jobno = materialused.jobno2 left join labour on jobrequest.jobno = labour.jobno4 ( jobrequest.jobno = '$item1') group jobrequest.jobno, jobrequest.vehicleno
Comments
Post a Comment