问题描述
- sql语句case when会报case关键字的错误
-
select * from shrzl a inner join
(select max(shrdh) shrdh,max(id) id from sfglb group by fhrdh)b on a.shrdh=b.shrdh
case when b.shrdh is not null then a.no=-1 end
解决方案
SQL的case when语句
sql语句中case when的用法
SQL语句中CASE WHEN用法
解决方案二:
select a.*,
case when b.shrdh is not null then -1 else a.no end ano from shrzl a inner join
(select max(shrdh) shrdh,max(id) id from sfglb group by fhrdh)b on a.shrdh=b.shrdh
时间: 2024-11-10 00:19:09