WITH DATA
AS ( select ACCT_ID_1, ACCT_ID, ACCT_ID_2 ... from two tables joined by criteria ),
DATA1
AS (SELECT D1.*
FROM DATA D1
WHERE ACCT_ID_1 = ACCT_ID AND ACCT_ID_1 = '101'),
DATA2
AS (SELECT D2.*
FROM DATA D2
WHERE ACCT_ID_2 = ACCT_ID AND ACCT_ID_2 = '101')
如果 data1 中有数据(没有来自 data2 的数据),我需要获取 data1,否则我需要从 data2 获取。可以使用 SQL 吗?