phpbar.de logo

Mailinglisten-Archive

Re: Join mit einer NOT Abfrage ?
Archiv Mailingliste mysql-de

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Join mit einer NOT Abfrage ?



> Ich möchte alle Treffer von B haben die in A nicht vorkommen ( also 3,7,
> 10) Wie muss ich das angehen? SELECT * FROM A, B where A.field1 !=
> B.field1 bringt ja keine sinnvolle Treffermenge :(

http://www.mysql.com/doc/J/O/JOIN.html:
> If there is no matching record for the right table in the ON or USING part in a
> LEFT JOIN, a row with all columns set to NULL is used for the right table. You
> can use this fact to find records in a table that have no counterpart in another
> table: 
> 
>      mysql> select table1.* from table1
>                 LEFT JOIN table2 ON table1.id=table2.id
>                 where table2.id is NULL;
> 
>      This example finds all rows in table1 with an id value that is not present
>      in table2 (that is, all rows in table1 with no corresponding row in
>      table2). This assumes that table2.id is declared NOT NULL, of course. See
>      section 12.5.5 How MySQL Optimizes LEFT JOIN and RIGHT JOIN. 

Meinst Du so?

P. Bierans

---
*** Weitere Infos zur Mailingliste und MySQL unter http://www.4t2.com/mysql 


Home | Main Index | Thread Index

php::bar PHP Wiki   -   Listenarchive