Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have table SCHEMETRN1 and SCHEMETRN2 which have SCHEME_ID and SCHEME_YEAR as common columns.
I want to get data from both these tables.Can any1 help me?
Posted
Comments
Garth J Lancaster 18-Jul-13 21:54pm    
Im not quite sure what your issue is - are you saying SCHEME_ID and SCHEME_YEAR are common to both tables, and you wish to use them in a join ?

for example

select a,b,c from SCHEMETRN1 S1, SCHEMETRN2 S2 where S1.SCHEME_ID=S2.SCHEME_ID and S1.SCHEME_YEAR=S2.SCHEME_YEAR

1 solution

I don't really get what you mean. But you can try to union it.

SQL
SELECT SCHEME_ID, SCHEME_YEAR
FROM  SCHEMETRN1

UNION

SELECT SCHEME_ID, SCHEME_YEAR
FROM  SCHEMETRN2


OR

SQL
SELECT *
FROM SCHEMETRN1
INNER JOIN SCHEMETRN2 ON SCHEMETRN2.SCHEME_ID = SCHEMETRN1.SCHEME_ID
    AND SCHEMETRN2.SCHEME_YEAR= SCHEMETRN1.SCHEME_YEAR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900