List:General Discussion« Previous MessageNext Message »
From:Yury V. Bukhman Date:March 6 2000 11:15pm
Subject:Re: Need some help to build a MySQL request ...
View as plain text  
Xavier COLLET-MATRAT wrote:

> Hi,
>
> I need some help to buid a MySQL request :
>
> I've a table buided like this :
>
> field1            field2          field3
> 1                 23              2
> 2                 23              12
> 3                 25              1
> 4                 25              3
> 5                 25              85
> 6                 26              16
> 7                 27              2
> 8                 27              12
> 9                 28              5
> 10                29              6
> ...
>
> I need to launch a "select" request to obtain (for exemple) all the values
> (field2) associated whith some field3 having at the same time the value 2
> and 12. In the exemple the request may return 23 and 27 ...
>

Seems that you need to join this table to itself like so:

SELECT a.field2
FROM your_table as a, your_table as b
WHERE a.field2 = b.field2
   AND a.field3 = 2
   AND b.field3 = 12

Hope this helps.

Yury

Thread
Need some help to build a MySQL request ...Xavier COLLET-MATRAT5 Mar
  • Re: Need some help to build a MySQL request ...Yury V. Bukhman7 Mar