id为空是,赋值为200
id为Null是,赋值为100
否则查出id的值
语句该怎么写?
select (case id when id is null then 100 when id='' then 200 else id end ) from mytable
id为Null是,赋值为100
否则查出id的值
语句该怎么写?
select (case id when id is null then 100 when id='' then 200 else id end ) from mytable
select
(case when id is null then 100
when id='' then 200
else id end
)
from mytable
select case when id is null then 100 when id='' then 200 else id end as id from mytable
id为Null是,赋值为100
否则查出id的值
语句该怎么写?
select (case id when id is null then 100 when id='' then 200 else id end ) from mytableselect case when id = '' then 200
when id is null then 100
else id
end
from mytable