By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,581 Members | 2,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,581 IT Pros & Developers. It's quick & easy.

Displaying Query Result Vertical Display

benchpolo
100+
P: 142
Expand|Select|Wrap|Line Numbers
  1. SELECT a.claimno
  2.     ,a.diagrefno
  3.     ,a.diag
  4.     ,a.diagdesc
  5.     ,b.diagrefno as diagrefno2 
  6.     ,b.diag as diag2
  7.     ,b.diagdesc as diagdesc2
  8.     ,c.diagrefno as diagrefno3
  9.     ,c.diag as diag3
  10.     ,c.diagdesc as diagdesc3
  11.     ,d.diagrefno as diagrefno4
  12.     ,d.diag as diag4
  13.     ,d.diagdesc as diagdesc4
  14.     ,e.diagrefno as diagrefno5
  15.     ,e.diag as diag5
  16.     ,e.diagdesc as diagdesc5
  17.  
  18. FROM ezcap1.archp.dbo.CLAIM_DIAGS a 
  19. LEFT OUTER JOIN ezcap1.archp.dbo.CLAIM_DIAGS b on a.CLAIMNO=b.CLAIMNO and b.diagrefno = 2
  20. LEFT OUTER JOIN ezcap1.archp.dbo.CLAIM_DIAGS c on a.CLAIMNO=c.CLAIMNO and c.diagrefno = 3
  21. LEFT OUTER JOIN ezcap1.archp.dbo.CLAIM_DIAGS d on a.CLAIMNO=d.CLAIMNO and d.diagrefno = 4
  22. LEFT OUTER JOIN ezcap1.archp.dbo.CLAIM_DIAGS e on a.CLAIMNO=e.CLAIMNO and e.diagrefno = 5
  23. WHERE a.diagrefno = 1
QUESTION
The script above displays data result horizontally. Question? How can I display data vertically?

Thanks.
Aug 30 '11 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,374
Don't join the table to itself.
Aug 30 '11 #2

NeoPa
Expert Mod 15k+
P: 31,561
As Rabbit says, but also sort by [DiagRefNo].
Aug 31 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.