Select Many-to-Many with more than one count? |
[eluser]Lockzi[/eluser]
Hi, I would love to do the following: select all rows where 'another_id' has more than one key_id but that key_id has no other. In this example: Code: relation_id key_id another_id PSUDO CODE Code: SELECT * FROM this_table WHERE another_id = 5 AND (each key_id in result DOESNOT have other another_id) The results should be: Code: 1 1 5 But NOT Code: 2 3 5 Since the key_id 3 also has another_id = 26: Code: 8 3 26 I've personally been facing this problem for a couple of days now. What I've found so far is subqueries (mainly from here http://shawnmccool.com/2009/09/18/using-...ubqueries/, but I just can't make it work the way I want it. Am I going about this all wrong? Greatly appreciated input, Lockzi |
Messages In This Thread |
Select Many-to-Many with more than one count? - by El Forum - 11-05-2010, 12:21 PM
|