随笔分类 - SQL-Server
摘要:insert into a ( 名称, 科目, 成绩 ) select 名称, 科目, 成绩 from b where 成绩 > 60
阅读全文
摘要:SQL不规则排序,ORDER BY 不规则排序,case的使用如下:ORDER BY case DisplaySizewhen 'S' then 1when 'M' then 2when 'L' then 3when 'XL' then 4when 'XXL' then 5when '3XL' then 6end
阅读全文
摘要:什么?error:消息 4148,级别 16,状态 1,第 1 行 XML methods are not allowed in a GROUP BY clause.解释: XML不允许使用排序方法好吧, 你牛, 不能用就不能用吧! 解决方法: 我先把数据取出来, 外面套个 "select" 你还管的了我?
阅读全文
摘要:insert into Print (printChannelStyleId,TemplateResourceID,CreateDate) select a.id, b.id,getdate() from PrintStyle as a,Template as b where a.catalogId in (27,28,29) and b.BindType=a.styleCode
阅读全文
摘要:SQL Server 2005 的新特性Row_Number()函数语法:ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN) 例子: select * from ( select *, ROW_NUMBER() OVER(Order by a.CreateTime DESC ) AS RowNumber from table_name as a ) as b where RowNumber BETWEEN 1 and 5将会返回table表其中有一列名字为 RowNumber, 编号从1开始示例: xlh row_num 1700 1
阅读全文