[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: Re: SQL SELECT HELP
From: Egor Egorov <egor.egorov () ensita ! net>
Date: 2004-04-30 13:30:46
Message-ID: 611am1xsbe.ln2 () blend ! ensita ! net
[Download RAW message or body]
zoltan.gyurasits@philips.com wrote:
>
> Sorry. My english is not so good. :(
> I try to explain.
>
> I have table1 :
>
> ID value
> --------------------------
> 1 100
> 1 101
> 1 102
> 1 200
> 2 100
> 2 300-------------------
> 2 310 |
> 3 100 |
> |
> and table2: |
> |
> value |
> ----------- |
> 300 <-----------------------------
>
>
> The result of the query should be from IDs of table1 (In this case 1,3) .
> The ID 2 is not allowed, because the table2 is the exception table wich is
> containing the value 300.
>
You need something like:
SELECT DISTINCT t3.id FROM table2 t2 INNER JOIN table1 t1 ON t1.value=t2.value
RIGHT JOIN table1 t3 ON t1.id=t3.id WHERE t1.id IS NULL;
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Egor Egorov
/ /|_/ / // /\ \/ /_/ / /__ Egor.Egorov@ensita.net
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic