Hi!
There are two tables:
create table a(
    id int primary key,
    name char(10),
    unique anamei (name)
);

create table b(
    id int primary key,
    name char(10),
    unique bnamei (name)
);

TASK:
select all ids for names which are unique among both tables:
example:
A:
1 a
2 b
3 c
4 d

B:
1 a
2 b
5 e
6 f

RETURNS: 3,4,5,6

For simplicity assume, that one name can be only onces in a table and
if names match then IDs also match. (2 - b cannot be 2 -c in another
table).

The trick is to do it in ONE SQL statement.

Regards,
Artem


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to