SQL Server Performance

Creating Query

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by mastersql, Aug 26, 2007.

  1. mastersql New Member

    I am working in SQL Server 2005

    I have one table naming Entry_Form
    Where I have columns

    ID -------- Name --------- Date ---------- Outlet
    1 -------- Gaurav --------- 07/07/2007 ---------- Paradise
    2 -------- Manish --------- 05/07/2007 ---------- Taj
    3 -------- Gaurav --------- 17/07/2007 ---------- 5 Star
    4 -------- Manish --------- 15/07/2007 ---------- Maharani
    5 -------- Ashish --------- 18/07/2007 ---------- Green Field
    6 -------- Gaurav --------- 19/07/2007 ---------- Paradise
    7 -------- Manish --------- 28/07/2007 ---------- Taj
    8 -------- Ashish --------- 21/07/2007 ---------- Green Field
    9 -------- Ashish --------- 01/07/2007 ---------- Green Field
    10 -------- Gaurav --------- 25/07/2007 ---------- 5 Star

    Now what I want I required a query where I required a fields like that
    Outlet-----------Date1--------Date2---------Date3-----------Date4
    Green Field ---18/07/2007---21/07/2007-----01/07/2007-------Null
    Taj------------05/07/2007---28/07/2007--------Null----------Null
    5 Star---------17/07/2007---25/07/2007--------Null----------Null
    Paradise-------07/07/2007---19/07/2007--------Null----------Null
    Maharani-------15/07/2007-----Null------------Null----------Null

    Something like that please help in this
    Please
    Thanks
    Ashish

  2. FrankKalis Moderator

    Have a look at the OUTER APPLY operator.
  3. Madhivanan Moderator

    Also read about Cross-tab reports in sql server help file

Share This Page