我在 Google 中找不到答案,因为我不知道关键字...所以这是我的查询
SELECT col1
from table1
WHERE col2 in (select col2 from table2 where user_id=@ID)
我想知道是否可以放置 if 条件语句...如果 table2 为空,那么我会改为使用此条件
select col1 from table1 <no condition>
就像select col2 from table2 where user_id=@id is null
它会提取所有数据一样
有人能帮我吗?