Oracle中的如何对应Sqlserver的UNION ALL?
发布网友
发布时间:2022-04-12 13:50
我来回答
共3个回答
热心网友
时间:2022-04-12 15:19
MS-SQL SERVER的UNION ALL联接用法是和ORACLE的UNION ALL用法一样的,不用修改。
SELECT DepotID, MLCode, MLName, PYCode, WBCode, UnitID, PDCode, PVCode,
Spec, JobNumber, effdate, ClassID, PjPrice, PriceRate, LjPrice,
'' AS shortname, '' AS snpycode, '' AS snwbcode, '' AS ZBCode, DepotAmount
FROM dbo.MEMMLDepot AS a
UNION ALL
SELECT DepotID, MLCode, MLName, PYCode, WBCode, UnitID, PDCode, PVCode, Spec,
JobNumber, effdate, ClassID, PjPrice, PriceRate, LjPrice,'' AS shortname,
'' AS snpycode, '' AS snwbcode, '' AS ZBCode, 0 AS DepotAmount
FROM dbo.MEMMaterial AS b
WHERE MLCode NOT IN(SELECT MLCode
FROM dbo.MEMMLDepot AS c
WHERE b.DepotID = DepotID
)
AND UsesFlag =1
热心网友
时间:2022-04-12 16:37
oracle也有 union all 语句
热心网友
时间:2022-04-12 18:12
SELECT A,B,C,D
FROM TABLE1
UNION ALL
SELECT E,F,G,H
FROM TABLE2