phpbar.de logo

Mailinglisten-Archive

Ergebnisse bekommen, auch wenn teilweise nichts drinnen ist

Ergebnisse bekommen, auch wenn teilweise nichts drinnen ist

Ralf Narozny mysql-de_(at)_lists.bttr.org
Thu, 18 Jul 2002 17:37:35 +0200


Hallo!

Grobmeier, Christian wrote:

> Hallo Leute,
> ich habe eine kleine Frage:
> nachfolgend seht ihr mal mein SQL Statement, das super funkt,
> aber nur ein Problem hat. Nämlich, wenn in einer Tabelle
> mal nichts drinsteht, z.b. keine Links zu dem Thema vorhanden sind,
> dann liefert das Statement gar nichts.
> Ich würde es aber gerne so einrichten, das es mir alles liefert
> was es findet.
> Ist das möglich?
> Vielen Dank schon mal im vorraus!
>
> Chris
>
>
> SELECT poss_members.visible_name                AS author,
>          poss_artist.name                       AS artist,
>          poss_releases.title                    AS articlename,
>          poss_reviews.date_submit               AS dateOfWriting,
>          poss_categories.species                AS style,
>          poss_reviews.points_music              AS pointsMusic,
>          poss_reviews.points_lyrics             AS pointsLyrics,
>          poss_reviews.points_sound              AS pointsSound,
>          poss_reviews.text                      AS review,
>          poss_contactperson.name                AS contactName,
>          poss_contactperson.firstname   AS contactFirstName,
>          poss_contactperson.street              AS contactStreet,
>          poss_contactperson.zip                 AS contactZip,
>          poss_contactperson.city                AS contactCity,
>          poss_contactperson.email               AS contactEmail,
>          poss_contactperson.phone               AS contactPhone,
>          poss_contactperson.mobile              AS contactMobile,
>          poss_contactperson.fax                 AS contactFax,
>          poss_label.name                                AS labelName,
>          poss_label.id                          AS labelID,
>          poss_links.id                          AS linkID,
>          poss_links.title                       AS linkTitle
> FROM    poss_categories,
>         poss_reviews,
>         poss_releases,
>         poss_artist,
>         poss_members,
>         poss_contactperson,
>         poss_label,
>         poss_links
> WHERE poss_reviews.id_member = poss_members.id
>   AND poss_reviews.id_releases = poss_releases.id
>   AND poss_releases.id_artist = poss_artist.id
>   AND poss_reviews.id_categories = poss_categories.id
>   AND poss_artist.id_contactperson = poss_contactperson.id
>   AND poss_releases.id_label = poss_label.id
>   AND poss_artist.id_links = poss_links.id
>   AND poss_reviews.id = '1'
>

Relativ einfach, mach aus allen where clauses der Form:

x.id = y.id

mal

(x.id = y.id OR y.id IS NULL OR x.id IS NULL)

allerdings solltest Du dann gut überlegen, in welcher Tabelle überhaupt 
etwas stehen muß und wie man dann verknüpfen kann und nur dort den Check 
auf NULL einbauen.

Gruß
 Ralf

-- 
Ralf Narozny
SPLENDID Internet GmbH & Co KG
Skandinaviendamm 212, 24109 Kiel, Germany
fon: +49 431 660 97 0, fax: +49 431 660 97 20
mailto:rnarozny_(at)_splendid.de, http://www.splendid.de



---
Infos zur Mailingliste, zur Teilnahme und zum An- und Abmelden unter
-->>  http://www.4t2.com/mysql 



php::bar PHP Wiki   -   Listenarchive