此查詢沒有顯示任何內容。我只想要那些在子查詢中匹配的ORDERNO結果。沒有一個組功能
SELECT SUM(STY.NQTY * STY.NUNITPRICE
/1000) AS ORDERAMOUNT,
(SELECT SUM(TBLORDERSTYLE.NQTY * TBLORDERSTYLE.NUNITPRICE/1000) FROM TBLORDER
INNER JOIN TBLORDERSTYLE
ON TBLORDER.CORDERNO = TBLORDERSTYLE.CORDERNO
WHERE TBLORDER.CLCNO LIKE '%MR#%' AND
TBLORDER.CORDERNO = ORD.CORDERNO
GROUP BY ORD.CORDERNO) AS K
FROM TBLORDER ORD INNER JOIN
TBLORDERSTYLE STY ON
ORD.CORDERNO = STY.CORDERNO
where (ORD.NPOSTFLAG = '1') AND
(ORD.NCANCEL = '0') AND
ORD.NPAYMODE = '1' AND
(ORD.DPICONFIRMDATE BETWEEN
TO_DATE('01-JUL-2012')AND TO_DATE('31-JUL-2012'))
請關掉你的大鎖,我們不喜歡人們在這裏大喊大叫。 – Mat 2013-02-11 08:59:55
墊 - 你有代表編輯帖子,爲什麼不這樣做? – APC 2013-02-11 09:57:34
而不是給我們你的不工作的SQL,請提供相關表格中的示例數據和所需輸出的示例。 – DazzaL 2013-02-11 10:43:56