学习 T -SQL (1)

基于msdn 详细学习T-SQL (http://msdn.microsoft.com/zh-cn/library/bb510741.aspx)

  1.  Aggregate function--Sum() Two Sample from msdn

    USE AdventureWorks; GO SELECT Color, SUM(ListPrice), SUM(StandardCost) FROM Production.Product WHERE Color IS NOT NULL AND ListPrice != 0.00 AND Name LIKE 'Mountain%' GROUP BY Color ORDER BY Color; GO

    USE AdventureWorks; GO SELECT Color, ListPrice, StandardCost FROM Production.Product WHERE Color IS NOT NULL AND ListPrice != 0.00 AND Name LIKE 'Mountain%' ORDER BY Color COMPUTE SUM(ListPrice), SUM(StandardCost) BY Color; GO  

你可能感兴趣的:(null)