MySQL Forums
Forum List  »  German

Alle aus Tabelle A bis auf die, die NULL als Wert haben
Posted by: Fabian O
Date: October 16, 2020 01:19PM

Hallo! Ich muss prüfen, ob userOption31 und userOption41 null sind, und diese Datensätze aus der Ergebnistabelle entfernen.
Bei meiner Abfrge sind weiterhin alle Datensätze drin, auch die mit entsprechenden NULL-Werten.
Ich weiß nicht, was ich falsch gemacht habe. Für Hilfe wäre ich sehr dankbar, denn mir gehen die Ideen aus.

Mein bisheriger Code:
SELECT DISTINCT u.userID AS 'User-ID' , u.username AS Username, v.userOption31 AS Vorname, v.userOption41 AS Nachname, v.userOption34 AS Position, v.userOption33 AS Funktion, v.userOption35 AS Straße, v.userOption36 AS Hausnummer, v.userOption37 AS PLZ, v.userOption38 AS Stadt, u.email AS 'E-Mail', v.userOption42 AS Telefon, m.subject AS 'Gutschein-Code'

FROM wcf1_user u

LEFT JOIN wcf1_user_option_value v
ON u.userID = v.userID AND (v.userOption31 IS NOT NULL AND v.userOption41 IS NOT NULL)
LEFT JOIN shop1_order o
ON v.userID = o.userID
LEFT JOIN shop1_order_modifier m
ON o.orderID = m.orderID

GROUP BY u.userID;

Options: ReplyQuote


Subject
Views
Written By
Posted
Alle aus Tabelle A bis auf die, die NULL als Wert haben
505
October 16, 2020 01:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.