List:General Discussion« Previous MessageNext Message »
From:Simcha Younger Date:July 21 2010 6:55am
Subject:Re: [PHP] MySQL select matching
View as plain text  
On Mon, 19 Jul 2010 10:36:40 -0600
"Ashley M. Kirchner" <ashley@stripped> wrote:


> mysql> select * from table where id='00001';
> +-------+-----+-----+---+
> | 00001 | 123 | 0.0 | C |
> | 00001 | 234 | 0.1 | D |
> | 00001 | 345 | 0.0 | D |
> | 00001 | 456 | 0.1 | C |
> | 00001 | 567 | 0.1 | G |
> +-------+-----+-----+---+
> 
>      Now, I have to find other IDs that match the above result.  In the 
> table, that would be ID '00003' (and in the entire DB, there may be 
> others as well - I need to find all those IDs.)  But, notice how ID 0003 
> isn't in the same order as ID 00001, but the data is still the same.
> 
select distinct id from `table` where concat(`b`, `c`, `d`) in (select concat(`b`,`c`,`d`
from `table` where id = '0001') AND id != '0001';
(untested)

-- 
Simcha Younger <simcha@stripped>
Thread
MySQL select matchingAshley M. Kirchner19 Jul
  • Re: MySQL select matchingMichael Dykman19 Jul
    • Re: [MySQL] Re: MySQL select matchingAshley M. Kirchner19 Jul
    • Re: MySQL select matchingRoberto Zárate Mendoza22 Jul
  • Re: MySQL select matchingMySQL)19 Jul
    • Re: [MySQL] Re: MySQL select matchingAshley M. Kirchner19 Jul
      • Re: [MySQL] Re: MySQL select matchingPeter Brawley19 Jul
  • Re: [PHP] MySQL select matchingSimcha Younger21 Jul