我有三张桌子。
CLIENTS
JOBS
INVOICES
我需要查看 INVOICES 表中某个日期之间按天分组的每一行,显示相关的 JOBID 以及连接的客户端(按名称)。发票仅通过 JOB ID 连接到客户端。
这有意义吗?
SELECT
j.ID As JobID,
CONCAT(c.FIRSTNAME, ' ', c.LASTNAME) As ClientName,
c.ID As ClientID
i.DATE
i.LENSES
i.FRAMES
i.TAXABLEGOODS
i.DISCOUNT
i.PAYMENT
i.PAYMENTTYPE
i.PREVIOUSBALANCE
FROM
JOBS j,
CLIENTS c,
INVOICES i,
WHERE
i.JOBID = j.ID
j.CLIENTID = c.ID
GROUP BY DATE
有什么建议么?