Query Help

Last Post 25 Aug 2009 08:36 AM by sql-tips. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
sql-tips
New Member
New Member

--
21 Aug 2009 11:07 AM
I have a table a(id , sequnece) both are primary key and have child table b(id,sequence)
values in table a are 1, 10442 in table b 1, 10442 1, 10443 2, 10443
2, 10443
I write a following query and results
select a.id,a.sequence
from a, b
where a.id = b.id
and a.sequence = b.sequence
and a.id in(1,2) and a.sequence in(10442,10443)

it results 1, 10442
1, 10443
2, 10443

but my results should eliminate 1, 10443 which does not exist in child table

how I rewrite the query with combination of keys

sql-tips
New Member
New Member

--
25 Aug 2009 08:36 AM
it is same thing I wrote right? I get the same results it not excluding 1,10443
You are not authorized to post a reply.

Acceptable Use Policy