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 > General > New Members & Introductions > Select 2 coulmns from same table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Feb 2013
Posts: 7
Select 2 coulmns from same table

I have 2 tables Job and Sor_item that are linked by a 3rd table Job_item
simple code gives:
job_number sor_item_code
16000045 14CW1400
16000045 14CW2240
16000045 14CW2340
16000161 14CW1400
16000161 14CW2240
16000161 14CW2340

I would like output like
job_number sor_item_code SOR_ITEM_CODE2
16000045 14CW2240 14CW2340
16000161 14CW2240 14CW2340

ie find which jobs have two sor_item_codes against them, limited to a list (IN ('xxx', 'yyy') and show the soritems in seperate columns

I think I need something like :
SELECT1
FROM1
(SELECT2
(SELECT3
FROM3
WHERE3) as SOR1
(SELECT4
FROM4
WHERE4) as SOR2
FROM2
JOIN OF SOME KIND
JOIN OF SOME KIND
WHERE2
WHERE1
I have tried all kinds for quite a while but am stuck.
please can you help?
Thanks
Nagog
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Feb 2013
Posts: 7
Any help appreciated. new user with my first thread. Thanks
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Feb 2013
Posts: 7
Please can someone help me/tell me if I have posted this in the correct place. 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