help in performing join

Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2007
Posts: 14
Reputation: bhakti.thakkar is an unknown quantity at this point 
Solved Threads: 1
bhakti.thakkar bhakti.thakkar is offline Offline
Newbie Poster

help in performing join

 
0
  #1
Mar 13th, 2008
hi all,

Table 1:

ID | COL1
1 | 1
1 | 13
1 | 64



Table 2:

ID | COL1
1 | 14
1 | 13


Output needed:

ID | COl

1 | 1
1 | 13
1 | 14
1 | 64

How will i accomplish this???

Thanks and regards
Bhakti
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: help in performing join

 
3
  #2
Mar 14th, 2008
  1. SELECT a.id, a.colname, b.colname FROM Table1 a JOIN Table2 a ON (a.id=b.id) WHERE a.id = '1' ORDER BY a.id ASC
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1
Reputation: ee_rlee is an unknown quantity at this point 
Solved Threads: 1
ee_rlee ee_rlee is offline Offline
Newbie Poster

Re: help in performing join

 
1
  #3
Mar 23rd, 2008
hi, you need to use union

SELECT ID, COL1 FROM Table1
UNION
SELECT ID, COL1 FROM Table2
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 14
Reputation: bhakti.thakkar is an unknown quantity at this point 
Solved Threads: 1
bhakti.thakkar bhakti.thakkar is offline Offline
Newbie Poster

Re: help in performing join

 
0
  #4
Mar 24th, 2008
Originally Posted by ee_rlee View Post
hi, you need to use union

SELECT ID, COL1 FROM Table1
UNION
SELECT ID, COL1 FROM Table2
hi,
thanks for your help. UNION Clause helped me to get the desired result
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MS SQL Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC