If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Query to return a subset of a set
I have an M2M relation with a link table (tblTagLinks) containing parent keys (PKey) and child keys (CKey).
I want to return the smallest set of PKey values which have links to two different CKey values. In other words, how do I combine SELECT tblTagLinks.PKey FROM tblTagLinks WHERE tblTagLinks.CKey = 88 and SELECT tblTagLinks.Pkey FROM tblTakLinks WHERE tblTagLinks.CKey = 50 to get only those PKey values where the result is a subset of CKey 88 containing only those records which also have a link containing CKey = 50? For example, if one set from tblTagLinks contains 12, 88 14, 88 19, 88 and another set contains 11, 50 12, 50 18, 50 I want an SQL statement which will select only 12 for the PKey I've tried AND and OR combinations, but all I get is either the empty set or a union. |
#2
|
|||
|
|||
Query to return a subset of a set
Please ignore this thread. I havn't thought the problem through yet.
|
Thread Tools | |
Display Modes | |
|
|