0
假设有一个表如何选择一行如果条件为true,所有行如果在sql中条件为false?
临时
COL1 | col ----
100 | c
456 | C1
131 | C2
-
假设我有coll1 = 100表示有效行的查询必须只返回行
如果值不表查询存在必须返回所有的行从表中。
注:如果存在,或任何程序上的东西(仅适用于SQL没有TSQL)
我们不能用下面
if exists(select 1 from temp where col1=100)
begin
select 1 from temp where col1=100
end
else
begin
select * from temp where col1=100
end
我们有先决条件,我们不能使用如果块和只有SQL –