TechSapphire Sunday, 2024-12-22, 5:51 AM
Site menu
Login form
News
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • Main » 2012 » October » 26
    Read complete article



    ----Basic but important functions
    --ROW_NUMBER()
    --RANK()
    --DENSE_RANK()
    --NTILE()

    --ROW_NUMBER() --Returns a sequential row number with in partition of result set
    use Northwind;
    SELECT ROW_NUMBER() over(order by productid) as [Row No.], ProductName from Products;

    ----Getting alternate rows
    ------Odd Row
    select * from (SELECT ROW_NUMBER() over(order by productid) as [Row No.], ProductName from Products) p where p.[Row No.]%2=1;
    ------Even Row
    select * from (SELECT ROW_NUMBER() over(order by productid) as [Row No.], ProductName from Products) p where p.[Row No.]%2=0;
    ------Row Between
    select * from (SELECT ROW_NUMBER() over(order by productid) as [Row No.], ProductName from Products) p where p.[Row No.]
    Between 5 and ... Read more »
    Category: Database | Views: 17434 | Added by: Admin | Date: 2012-10-26 | Comments (1)

    Categories
    Programming [27]
    Tips for programming
    Security [2]
    Security Tips
    Google [1]
    Use google faster then ever you use
    Project [14]
    HTML [2]
    Electronics [0]
    Data Structure [0]
    Database [16]
    SQL SERVER
    SSRS [1]
    Sql Server Reporting Services
    Copyright MyCorp © 2024