Click here to Skip to main content
15,917,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
in my case
i have a table personal like
name   book
josh   bk101
alen   bk101
josh   bk102


also another table fine like
name   book
josh   bk101
alen   bk101


i have to check whether the record in fine table.at a time i have to check both cases.
Posted
Updated 20-Dec-12 20:36pm
v3

1 solution

try this...
SQL
select a.*, case when b.name is null then 'yes' else 'no' end as IsExistInFineTbl
from Personal as a
Left join fine as b on a.name=b.name and a.book=b.book


result...
name   book  IsExistInFineTbl
-----------------------------------------------
josh   bk101   yes
alen   bk101   yes
josh   bk102   no

Happy Coding!
:)
 
Share this answer
 
Comments
josh-jw 21-Dec-12 2:50am    
thnx aarti..:).
Aarti Meswania 21-Dec-12 2:52am    
welcome! :)
Glad to help you! :)

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