From: Daevid Vincent Date: October 6 2006 12:05am Subject: How can I extract 3 IDs from only 2 columns/rows? List-Archive: http://lists.mysql.com/mysql/202354 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have written a bug tracking system (http://sourceforge.net/projects/roachphp which is pretty out of date currently). It has a feature to regress a CR ("change request", previously known as = a "bug"). That is, if you fix a CR in maint, you can duplicate it to trunk = so that you can test it there too. I also have this table that tracks these copies. Now I want to start = showing the 'tree' and also optionally be able to weed out regressed CRs from listings. But I'm stuck. Given a table like this, how can I get a list of all THREE CRs / BIDs.=20 select * from release_hack where BID in (5749, 7355, 6454); +-----------+------+------+---------------------+ | ReleaseID | BID | oBID | TS | +-----------+------+------+---------------------+ | 72 | 6454 | 5749 | 2006-05-18 11:05:52 |=20 | 67 | 7355 | 5749 | 2006-07-25 16:29:26 |=20 +-----------+------+------+---------------------+ I have a 'bug' table with a BID of course which the above is a reference too. The problem is that people don't always copy from the original CR. = Someone might fix something in say 4.5 (trunk) and then clone the CR to 4.2 = (maint), then use THAT cloned one to clone again to another version (higher or lower). This example they happen to be the same original one. But in = theory the logic would work the same. This could very easily look like this too: +-----------+------+------+---------------------+ | ReleaseID | BID | oBID | TS | +-----------+------+------+---------------------+ | 72 | 6454 | 5749 | 2006-05-18 11:05:52 |=20 | 67 | 7355 | 6454 | 2006-07-25 16:29:26 |=20 +-----------+------+------+---------------------+ So what I want to get is a query or set of queries (I'm using PHP and = mySQL 5.0.22 but not INNODB) that given any one of the three BIDs (5749, 7355, 6454) I can get the other two back, reguardless of which column it = starts in. =D0=C65=CF=D0=20