摘要:
--动态多加字段--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 '中高端产品 阅读全文
摘要:
以查询前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 阅读全文