Kayıtlar

Kasım, 2013 tarihine ait yayınlar gösteriliyor

How to retrieve the top N rows for each group

-- Solution   for   SQL   Server   2000   and   later       SELECT   ProductID ,           CategoryID ,           UnitPrice    FROM     @ Products   p1    WHERE    ProductID   IN  ( SELECT   TOP   3   ProductID                          FROM     @ Products   p2                          WHERE    p1 . CategoryID  =  p2 . CategoryID                          ORDER    BY   UnitPrice   DESC )  ORDER   BY   CategoryID ,  UnitPrice   DESC source : http://gallery.technet.microsoft.com/scriptcenter/How-to-retrieve-the-top-N-248cdc67

T-Sql Case When

CASE WHEN durum1 THEN  yapılacaklar WHEN durum2 THEN yapılacaklar ELSE  yapılacaklar END

WITH common_table_expression (Transact-SQL)

WITH Sales_CTE (SalesPersonID, NumberOfOrders) AS ( SELECT SalesPersonID, COUNT(*) FROM Sales.SalesOrderHeader WHERE SalesPersonID IS NOT NULL GROUP BY SalesPersonID ) SELECT AVG(NumberOfOrders) AS "Average Sales Per Person" FROM Sales_CTE; GO source : http://msdn.microsoft.com/en-us/library/ms175972.aspx