Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Data required in Column

Author  Topic 

anandbohra
Starting Member

4 Posts

Posted - 2007-06-09 : 03:43:50
Dear all
i am newbie to this forum as well as learning SQL so don't have much knowledge.
i want one query which will transpose data in column
i have 3 fileds
Scrip--COC--DAte
A--25--01/06/07
B--34--01/06/07
C--65--01/06/07
A--65--02/06/07
B--98--02/06/07
C--37--02/06/07


now i want a query which shows data in this way

SCRIP--01/06/07--02/06/07--03/06/07
A--25--65--....
B--34--98--....
C--65--37--....

now this date column will be only 5 i.e. 1 which user puts + 4 preceding dates from user date (ignoring sequence means if user put 10/06/07 then next will be 09/06/07 but if this wont exists then take 08/06/07 & so on till 4 dates)
the data will be unique means no scrip repeats more than once in a day

pl reply soon

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-09 : 04:10:40
Refer this
http://weblogs.sqlteam.com/jeffs/archive/2005/05/02/4842.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -