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
 Transact-SQL (2005)
 need help on dynamic query

Author  Topic 

shaik.zakeer
Posting Yak Master

117 Posts

Posted - 2009-11-06 : 09:21:12
i have a result set like

item scr date1 date2

rating 100 2 3
comments 100 abc def
aa 7 null null
bb 6 null null
cc 5 null null
dd 4 null null
ee 3 null null
ff 2 null null


i want to convert this resultset into like the below


item scr date1 date2

rating 100 2 3
aa 7 null null
bb 6 null null
cc 5 null null
dd 4 null null
ee 3 null def
ff 2 abc null


note: i am getting the actual resultset thru dynamic queries and the date columns are getting generated based on the
period selected.

can i able to do this.





Thanks

Jack

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-06 : 09:32:46
I cannot see a logic to decide when 'def' or 'abc' is to put into a column.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

shaik.zakeer
Posting Yak Master

117 Posts

Posted - 2009-11-06 : 09:55:34
if date1 = 7 then we need to place the comments at score = 7 place.

Here date1 is 2 that's why i placed 'abc' in score = 2 position.
same thing date2 is 3 that's why i placed 'def' in score = 3 position.

hope this is what you are expecting......


Thanks

Jack
Go to Top of Page
   

- Advertisement -