use pubs
GO
select category =
Case type
when 'popular_comp' then 'popular computing'
when 'mod_cook' then 'modern cooking'
when 'business' then 'Business'
when 'psychology' then 'Psychology '
when 'trad_cook' then 'trad_cook222' else 'not yet categoried'
EndCAST(title as varchar(25)) as 'Shorterned title',price as Price
From titles
where price is not null
order by type,price
compute avg(price) by type
GO
select category =
Case type
when 'popular_comp' then 'popular computing'
when 'mod_cook' then 'modern cooking'
when 'business' then 'Business'
when 'psychology' then 'Psychology '
when 'trad_cook' then 'trad_cook222' else 'not yet categoried'
EndCAST(title as varchar(25)) as 'Shorterned title',price as Price
From titles
where price is not null
order by type,price
compute avg(price) by type
解决方案 »
- 题目
- 一个类似循环的查询问题!请高手帮忙!
- JDBC基础问题
- SELECT name FROM master.dbo.sysdatabases WHERE name = N'TaskVision'中的N是什么意思?
- MSSQL 2005 怎么维护全库的索引?
- Windows2008R2里装SqlServer2008,数据库使用复制,无法进行订阅
- 根据值来取字段名
- SQL 70 安装时只装了一个license,现在只能有一个客户端访问,怎样修改才能多用户访问?
- Microsoft.Jet.OLEDB.4.0連接問題
- 我要删除表中的所有重复的记录,语句怎么写呀??(在线,急!!!!!)
- 这个select 查询怎么不对啊?
- 一个简单SQL查询语句
Case type
when 'popular_comp' then 'popular computing'
when 'mod_cook' then 'modern cooking'
when 'business' then 'Business'
when 'psychology' then 'Psychology '
when 'trad_cook' then 'trad_cook222' else 'not yet categoried'
End
,
CAST(title as varchar(25)) as 'Shorterned title',price as Price
From titles
where price is not null
order by type,price
compute avg(price) by type
GO
select category =
Case type
when 'popular_comp' then 'popular computing'
when 'mod_cook' then 'modern cooking'
when 'business' then 'Business'
when 'psychology' then 'Psychology '
when 'trad_cook' then 'trad_cook222' else 'not yet categoried'
End
,
CAST(title as varchar(25)) as 'Shorterned title'
,price as Price
From titles
where price is not null
order by type,price
compute avg(price) by type
----case when end后面少了一个逗号哦