Link to home
Start Free TrialLog in
Avatar of sanjayjs
sanjayjs

asked on

Haw to apply join on 2 tables with this scenario

Table a contains
rno subjectcode
1       a
1       b
1       c
1       d
2       a
2       b
2       c
2       d

Now table b contains
rno subjectcode
1      c
2      b
2      d

I want to fetch the subjectcodes for every uid missing from table b. But which exists in table a.      

conta
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Try..quick..

SELECT rno subjectcode  FROM TABLEA
EXCEPT
SELECT rno subjectcode  FROM TABLEB
or this...

SELECT a.* FROM TABLEA a
LEFT JOIN TABLEB on a.rno = b.rno and a.subjectcode = b.subjectcode 
WHERE b.rno IS NULL

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sanjayjs
sanjayjs

ASKER

Ok