List:General Discussion« Previous MessageNext Message »
From:Jerry Schwartz Date:October 6 2006 1:12pm
Subject:RE: How can I extract 3 IDs from only 2 columns/rows?
View as plain text  
I'm a newbie, for sure, but can't you use OR to accomplish this?

SELECT * FROM release_hack WHERE BID IN (5749, 7355, 6454)
	OR oBID IN (5749, 7355, 6454);

Could it be as simple as I am?

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341


> -----Original Message-----
> From: Daevid Vincent [mailto:daevid@stripped]
> Sent: Thursday, October 05, 2006 8:06 PM
> To: mysql@stripped
> Subject: How can I extract 3 IDs from only 2 columns/rows?
>
> 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.
>
> select * from release_hack where BID in (5749, 7355, 6454);
> +-----------+------+------+---------------------+
> | ReleaseID | BID  | oBID | TS                  |
> +-----------+------+------+---------------------+
> |        72 | 6454 | 5749 | 2006-05-18 11:05:52 |
> |        67 | 7355 | 5749 | 2006-07-25 16:29:26 |
> +-----------+------+------+---------------------+
>
> 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 |
> |        67 | 7355 | 6454 | 2006-07-25 16:29:26 |
> +-----------+------+------+---------------------+
>
> 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.
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>
>



Thread
How can I extract 3 IDs from only 2 columns/rows?Daevid Vincent6 Oct
RE: How can I extract 3 IDs from only 2 columns/rows?Jerry Schwartz6 Oct
  • RE: How can I extract 3 IDs from only 2 columns/rows?Daevid Vincent6 Oct