我已经尝试了UNION语句,但是只打印出第一个查询,而跳过其余查询。如何在1个表格中打印多个查询?不论是否使用UNION语句。
SELECT DISTINCT
[5028account]
FROM
XXX
WHERE
StresstestaccountEnabled LIKE '%Yes%' AND BalancesheetAmount <> 0
AND
PATINDEX('%[^0-9]%', [5028account]) > 0 OR [5028account] IS NULL
UNION
SELECT DISTINCT
[1001account]
FROM
XXX
WHERE
StresstestaccountEnabled LIKE '%Yes%' AND BalancesheetAmount <> 0
AND
PATINDEX('%[^0-9]%', [1001account]) > 0 OR [1001account] IS NULL
UNION
SELECT DISTINCT
[BalanceSheetType]
FROM
XXX
WHERE
StressTestAccountEnabled LIKE '%Yes%' AND BalanceSheetAmount <> 0
AND
[BalanceSheetType] NOT LIKE '%Assets%'
AND
BalanceSheetType NOT LIKE '%Liabilities%'
UNION
SELECT DISTINCT
CorepRRR
FROM
XXX
WHERE
StressTestAccountEnabled LIKE '%Yes%' AND BalanceSheetAmount<>0
AND
CorepRRR NOT LIKE '%D%'
AND
CorepRRR NOT LIKE '%R%'
AND
CorepRRR NOT LIKE '%P%'
AND
CorepRRR NOT LIKE '%Not Applicable%'
答案 0 :(得分:1)
打印所有查询中的所有数据!!!!! 1:
union all