我得到了下面的查詢:SQL UNION語句
SELECT
ep_101.cd_hfdmapnr AS Dossiernummer,
SUM(ep_102.id_fhmbdlv) AS Kosten
FROM ep_101
INNER JOIN et_101 ON ep_101.cd_hfdmapnr = et_101.cd_hfdmapnr
INNER JOIN ep_102 ON ep_101.cd_hfdmapnr = ep_102.cd_hfdmapnr
WHERE ep_101.cd_mapkverw = 0
AND ep_102.cd_bkcode = '000010'
AND et_101.opdrachtgever1 = '05354605'
GROUP BY ep_101.cd_hfdmapnr
UNION
SELECT
ep_101.cd_hfdmapnr AS Dossiernummer,
SUM(ep_102.id_fhmbdlv) AS GriffieKosten
FROM ep_101
INNER JOIN et_101 ON ep_101.cd_hfdmapnr = et_101.cd_hfdmapnr
INNER JOIN ep_102 ON ep_101.cd_hfdmapnr = ep_102.cd_hfdmapnr
WHERE ep_101.cd_mapkverw = 0
AND ep_102.cd_bkcode = '000020'
AND et_101.opdrachtgever1 = '05354605'
GROUP BY ep_101.cd_hfdmapnr
雖然結果只給回Dossiernummer & Kosten我怎樣才能重新它使「Griffiekosten」也顯示?因爲我的想法....
修復那麼你的'組by'條款。 –
工作感謝ALLOT! –