作业帮 > 综合 > 作业

case when then else end 能用在条件判断上么

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/20 06:48: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 能用在条件判断上么
可以!
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