case when then else end 能用在条件判断上么比如select * from app a where --在这加case when 可以么?select * from app a where case when a.id = 1 then a.name = '22' else a.name = '33'
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/11 19:31:03
case when then else end 能用在条件判断上么比如select * from app a where --在这加case when 可以么?select * from app a where case when a.id = 1 then a.name = '22' else a.name = '33'
case when then else end 能用在条件判断上么
比如
select * from app a where --在这加case when 可以么?
select * from app a where case when a.id = 1 then a.name = '22' else a.name = '33'
case when then else end 能用在条件判断上么比如select * from app a where --在这加case when 可以么?select * from app a where case when a.id = 1 then a.name = '22' else a.name = '33'
可以!
where expression
但是expression 必须是返回布尔值的表达式
--------------------------------------
比如
SELECT [OrderID]
,[CustomerID]
,[EmployeeID]
,[OrderDate]
,[RequiredDate]
,[ShippedDate]
,[ShipVia]
,[Freight]
,[ShipName]
,[ShipAddress]
,[ShipCity]
,[ShipRegion]
,[ShipPostalCode]
,[ShipCountry]
FROM [Northwind].[dbo].[Orders] where case when [CustomerID]='VINET' then [EmployeeID] end >1