Filesystems 我可以在where子句中使用if子句吗?
这看起来像SQL,所以我用这种方式回答 使用Filesystems 我可以在where子句中使用if子句吗?,filesystems,Filesystems,这看起来像SQL,所以我用这种方式回答 使用案例语句: where if prog.levelnumber = 2 then i.level = 2 ---> select only the persons with level = 2 if prog.numnivel=1 then i.level = 1 ---> select only the persons with level = 1 请尽量澄清你的问题——谢谢
案例
语句:
where
if prog.levelnumber = 2 then
i.level = 2 ---> select only the persons with level = 2
if prog.numnivel=1 then
i.level = 1 ---> select only the persons with level = 1
请尽量澄清你的问题——谢谢
select fields
from tablename
where i.level = case prog.levelnumber
when 2 then 2
else
case prog.numnivel
when 1 then 1
end
end