我想加入两个选择查询,但不知道该怎么做。
第一个查询为我提供了有关发票编号、客户、eventid 和金额的信息,这些信息都保存在发票表中:
SELECT invoice.Eventid, invoice.Invoiceno,
event.clientid, client.clientid, clientname, gross_amount, VAT, total, due
FROM client, invoice, event,
WHERE event.eventid=invoice.eventid and event.clientid = client.clientid group by invoice.eventid
第二个查询是检查员工的薪水
SELECT event_ma.eventid, salary.staffid, SUM( cost_hour * TIME_TO_SEC( TIMEDIFF( hours, pause ) ) ) /3600 AS costs
FROM salary
JOIN event_ma ON salary.staffid = event_ma.staffid
GROUP BY event_ma.eventid
最后,我想查看每个事件的所有相关成本和收入。