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)
 Result Display

Author  Topic 

dutyfree
Starting Member

5 Posts

Posted - 2009-11-13 : 13:56:08
Hello

I wish to display the following output into the one below this.

ID Prc PID Ask Bid
---------------- ------- ---------------- ------- ------
091113044932.138 103.399 2009111223493223 109.004 (null)
091113044932.138 103.399 2009111223493223 108.53 (null)
091113044932.138 103.399 2009111223493223 103.399 (null)
091113092441.543 99.649 200911130424413 (null) 93.482
091113092441.543 99.649 200911130424413 (null) 96.719
091113092441.543 99.649 200911130424413 (null) 92.613
091113092441.543 99.649 200911130424413 (null) 99.649
091113092441.543 99.649 200911130424413 (null) 91.28
091113151718.664 92.104 2009111310171827 (null) 92.018
091113151718.664 92.104 2009111310171827 (null) 97.155
091113151718.664 92.104 2009111310171827 (null) 92.104

Into the results below

ID Prc PID P1 P2 P3 P4 P5
---------------- ------- ---------------- ---- --- ---- ---- ----
091113044932.138 103.399 2009111223493223 103.399 108.53 109.004 (null) (null)
091113092441.543 99.649 200911130424413 91.28 92.613 93.482 96.719 99.649
091113151718.664 92.104 2009111310171827 92.018 92.104 97.155 (null) (null)


Basically i need to change the rows Ask and Bid into columns.

I wish to avoid PIVOT usage. Any other ideas on how i can achieve this

thanks

X002548
Not Just a Number

15586 Posts

Posted - 2009-11-13 : 13:57:54
That should help use read it...use code tags

quote:
Originally posted by dutyfree

Hello

I wish to display the following output into the one below this.

ID Prc PID Ask Bid
---------------- ------- ---------------- ------- ------
091113044932.138 103.399 2009111223493223 109.004 (null)
091113044932.138 103.399 2009111223493223 108.53 (null)
091113044932.138 103.399 2009111223493223 103.399 (null)
091113092441.543 99.649 200911130424413 (null) 93.482
091113092441.543 99.649 200911130424413 (null) 96.719
091113092441.543 99.649 200911130424413 (null) 92.613
091113092441.543 99.649 200911130424413 (null) 99.649
091113092441.543 99.649 200911130424413 (null) 91.28
091113151718.664 92.104 2009111310171827 (null) 92.018
091113151718.664 92.104 2009111310171827 (null) 97.155
091113151718.664 92.104 2009111310171827 (null) 92.104

Into the results below

ID Prc PID P1 P2 P3 P4 P5
---------------- ------- ---------------- ---- --- ---- ---- ----
091113044932.138 103.399 2009111223493223 103.399 108.53 109.004 (null) (null)
091113092441.543 99.649 200911130424413 91.28 92.613 93.482 96.719 99.649
091113151718.664 92.104 2009111310171827 92.018 92.104 97.155 (null) (null)


Basically i need to change the rows Ask and Bid into columns.

I wish to avoid PIVOT usage. Any other ideas on how i can achieve this

thanks




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-11-13 : 14:00:01
here's a hack for you

http://weblogs.sqlteam.com/brettk/archive/2005/02/23/4171.aspx



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

dutyfree
Starting Member

5 Posts

Posted - 2009-11-13 : 14:10:21
Hi Brett

Thanks for all this.

The hack seems too much work to apply in a proc.

Any more ideas?

Much appreciated

Thanks
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-11-13 : 14:25:00
Why can't you use PIVOT?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -