0

我有三张桌子。

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

有什么建议么?

4

1 回答 1

0

如何使用:

WHERE your_date between first_date AND last_date GROUP BY YEAR(your_date), MONTH(your_date), DAY(your_date);
于 2012-09-22T21:22:47.953 回答