phpbar.de logo

Mailinglisten-Archive

AW: Nicht verwendetet ID abfragen

AW: Nicht verwendetet ID abfragen

Thomas Bach mysql_(at)_lists.phpcenter.de
Sun, 22 Apr 2001 22:34:34 +0200


At 20:57 22/04/01 +0200, you wrote:
>Hallo zusammen
>Hier ist nocheinmal alles :-) (mit daten) denn es geht immer noch nicht.
>Die abfrage sollte ergeben:
>1,3,4,10
>
>die sind alle nicht verwendet
>
>SELECT name, vorname
>FROM kontakt
>LEFT JOIN anlass USING (kon_id)
>LEFT JOIN stellen USING (kon_id)
>WHERE anlass.kon_id=NULL AND
>stellen.kon_id=NULL
>
>habe ich getestet wird gar nichts angezeigt wenn ich aber where klausel fort
>lasse geht es jedoch stimmt das ergebnis nicht :-(
>
>Hat jemand eine lösung?
>
>mfG
>
>Thomas Michel


Hallo

mysql> select kon_id from kontakt;
+--------+
| kon_id |
+--------+
|      1 |
|      2 |
|      3 |
|      4 |
|      5 |
|      6 |
|      8 |
|     10 |
+--------+
8 rows in set (0.00 sec)

mysql> select kon_id from stellen;
+--------+
| kon_id |
+--------+
|      2 |
+--------+
1 row in set (0.00 sec)

mysql> select kon_id from anlass;
+--------+
| kon_id |
+--------+
|      0 |
|      0 |
|      0 |
|      0 |
|      0 |
|      6 |
|      6 |
|      8 |
+--------+
8 rows in set (0.01 sec)

mysql> SELECT kontakt.kon_id,name, vorname
     -> FROM kontakt
     -> LEFT JOIN anlass ON kontakt.kon_id = anlass.kon_id
     -> LEFT JOIN stellen ON kontakt.kon_id = stellen.kon_id
     -> WHERE anlass.kon_id IS NULL AND
     -> stellen.kon_id IS NULL;
+--------+-------------+---------+
| kon_id | name        | vorname |
+--------+-------------+---------+
|      1 | Baschung    | Herbert |
|      3 | Mühlethaler | Regula  |
|      4 | Geiser      | Ursula  |
|      5 |             |         |
|     10 | test        | test    |
+--------+-------------+---------+
5 rows in set (0.00 sec)

zwei, drei _kleine_ verpatzer meinerseits ...
hoffe, det is nu das gesuchte

macht än schtutz!

Gruss
Thomas

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



php::bar PHP Wiki   -   Listenarchive