一条sqL查不到数据返回另一条sql的记录
发布网友
发布时间:2022-04-11 09:36
我来回答
共4个回答
热心网友
时间:2022-04-11 11:05
if (select count(*) from t1)!=null
select a from t1
else
select a2 from t2
end
热心网友
时间:2022-04-11 12:23
select a from t1
Union
(select a2 from t2 where not exists (select a from t1))
热心网友
时间:2022-04-11 13:58
select a from t1
UNION ALL
select a2 from t2 WHERE (SELECT count(1) from t1 WHERE ROWNUM=1) = 0
热心网友
时间:2022-04-11 15:49
MSSQL
IF EXISTS(select a from t1)
select a from t1
ELSE
select a2 from t2