摘要:
--动态多加字段--Case的搜索函数 (多个条件判断) 多加一列SELECT ROW_NUMBER() over (order by [RealPrice] desc )a ,[SaleId], --(case when RealPrice >0 and RealPrice<=100 then '低端产品'--when RealPrice >100 and RealPrice<=500 then '中端产品'--when RealPrice >500 and RealPrice<=1000 then '中高端产品 阅读全文
posted @ 2012-11-28 19:07
黎明&岁月
阅读(230)
评论(0)
推荐(0)
摘要:
以查询前20到30条为例,主键名为id方法一: 先正查,再反查select top 10 * from (select top 30 * from tablename order by id asc) A order by id desc方法二: 使用left joinselect top 10 A.* from tablename A left outer join (select top 20 * from tablename order by id asc) Bon A.id = B.idwhere B.id is nullorder by A.id asc方法三: 使用not exis 阅读全文
posted @ 2012-11-28 19:03
黎明&岁月
阅读(2951)
评论(1)
推荐(0)

浙公网安备 33010602011771号