Afficher un message
Vieux 26/04/2006, 13h27   #1
xhenxhe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Odd query from multiple tables (brainbuster)

I'm wondering if something like this can be done in mysql...

I have two tables I want to pull data from. One table will contain a
unique user_id which I could pull out like:

select user_id from table;

that's basically all I would need from that table. The second table
contains a user id field, but can have several duplicate user_id's in
the table. Essentially I would need:

select distinct user_id from table2 where user_id != owner_id;

Then between the results of the two queries, I would like to remove any
duplicate user_id's. I can do this easy enough in PHP, but I would
prefer to increase my mysql skills. Is it possible to somehow combine
these two queries into one and pull out the uniques using distinct?

Thanks in advance!

  Réponse avec citation
 
Page generated in 0,05775 seconds with 9 queries