For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > January 2008 > Re: [PHP-DB] Select...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Select...
Niel Archer

2008-01-15, 8:01 am

Hi

First off, please create your own thread, do not reply to someone else's
and change the subject.

> I'm having kind of trouble to get done this: Select data from a table,
> except those data already in a second table. Actually, if there is a rowid
> in table2, I wont get it from table1, rowid is the key that relates both
> tables.
>
> I just can't express this with a SQL statement!! idequipomed is the key that
> relates both tables!!
> So, if idequipomed is already in Table2, I shouldn't get it from Table1.
> Any suggestions?


You need to do a join between the two tables using the common column to
make the connection. This should get you started

SELECT * FROM Table1 RIGHT JOIN Table2 USING (idequipomed) WHERE Table1.idequipomed
IS NULL


--
Niel Archer
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com