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'
比如
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
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
case when.then.else.end
case when then else end
(case A.ZT when 1 then 's318' else null end)
CASE a WHEN 1 THEN b ELSE NULL END
select CNAME=case when CNAME is null then '4' else '1' end f
--简单Case函数 CASE sex WHEN '1' THEN '男' WHEN '2' THEN '女' ELSE
SELECT CASE ABC.A WHEN'否' THEN'1' WHEN'是' THEN'-1' END AS 出入
c#开发cast( (case when b.pbproject_ID is null then 1 else 0 en
case when语句结尾用end 还是end case
VB中的IF语句能如下用吗?IF 条件1 Then If条件2 Then 语句1 Else 语句2 End If Els
sql case when then ...虚心求教
IF then else end if 怎么用的?