If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > query help please

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-08-04, 19:59
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
query help please

Hi,

I have data as follows in a table called TNR_RESP


RESP_ID | TYP_ID | CXL_RESP_ID
123 | 1 | ABC
ABC | 0 |

If i pass RESP_ID = 123 to the query, i wanted to see RESP_ID, TYP_ID, CXL_RESP_ID and TYP_ID of CXL_RESP_ID

Here ABC is reference of another RESP_ID in the same table
I want to see the result as follows

123 1 ABC 0

How do we get the result?
I appreciate your help.

Thanks

Last edited by manth; 12-08-04 at 20:03.
Reply With Quote
  #2 (permalink)  
Old 12-09-04, 03:56
xamar xamar is offline
Registered User
 
Join Date: Apr 2004
Posts: 39
reply

This is one way of doing...

SELECT A.RESP_ID, A.TYP_ID, A.CXL_RESP_ID, B.TYP_ID
FROM TNR_RESP A, TNR_RESP B
WHERE
A.RESP_ID=123 AND
A.CXL_RESP_ID=B.RESP_ID
Reply With Quote
  #3 (permalink)  
Old 12-22-04, 07:50
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
Excellent, Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On