我需要一点帮助。我有两张我知道需要加入的表,这不是问题。我需要显示的是发票中购买的所有产品的发票编号、发票日期和总美元金额。信息需要按发票编号降序排列,然后按发票日期升序排列。到目前为止,我所拥有的并且正在引发错误的是:
SELECT LINE.INV_NUMBER,
INVOICE.INV_DATE,
SUM(LINE.LINE_PRICE)
FROM LINE
FULL OUTER JOIN INVOICE ON LINE.INV_NUMBER=INVOICE.INV_NUMBER
GROUP BY LINE.INV_NUMBER
ORDER BY LINE.INV_NUMBER DESC,
INVOICE.INV_DATE ASC;
在我拔出所有头发之前,我们将不胜感激。
更新:
我已将我的声明更新为:
SELECT LINE.INV_NUMBER AS "Line Number",
INVOICE.INV_DATE AS "Invoice Date",
SUM(LINE.LINE_PRICE) AS "Total Sales"
FROM INVOICE FULL OUTER JOIN LINE ON INVOICE.INV_NUMBER=LINE.INV_NUMBER
GROUP BY LINE.INV_NUMBER, INVOICE.INV_DATE
ORDER BY LINE.INV_NUMBER DESC, INVOICE.INV_DATE ASC;
我得到的是数据而不是错误。我现在遇到的问题是我需要按发票编号按降序读取数据,按发票日期按升序读取,所以我假设我需要两个数据输出。我该怎么做?