Find MySQL entries with same set of column B values for their common column A value

Posted by nnsd44g on Stack Overflow See other posts from Stack Overflow or by nnsd44g
Published on 2010-05-18T19:37:07Z Indexed on 2010/05/18 19:40 UTC
Read the original article Hit count: 187

Filed under:

I have:

+----+------+------+
| id | A    | B    |
+----+------+------+
|  1 |    1 |    1 |  <
|  2 |    1 |    2 |  <
|  3 |    2 |    2 | 
|  4 |    2 |    3 | 
|  5 |    3 |    1 |  <
|  6 |    3 |    2 |  <
|  7 |    4 |    4 | 
|  8 |    4 |    5 | 
+----+------+------+

I need to select the entries that have the same set of B values for their common A value. So, in this case, I need ids 1, 2 and 5, 6 because in those cases the sequence of B values is 1, 2.

Is this possible?

Thanks!

© Stack Overflow or respective owner

Related posts about mysql