Autor Beitrag
Philipp_Reitter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: Mo 13.08.07 19:46 
hi...

ich lass in meiner MySql DB folgenden befehl ausführen:

ausblenden Quelltext
1:
 SELECT * FROM categories WHERE id=NULL					


aber ich bekomme immer NICHTS zurück!
kann ich nicht nach NULL fragen?
und wenn nein wie soll ich dann jene mit NULL finden?

mfg
Philipp
little-wolf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 47

WinXP
Delphi 5 Enterprise, Delphi 2006 Enterprise
BeitragVerfasst: Mo 13.08.07 20:05 
hallo philipp_reitter

versuchs mal mit "IS NULL"

ausblenden SQL-Anweisung
1:
SELECT * FROM categories WHERE id IS NULL					


gruss

little-wolf
Philipp_Reitter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: Mo 13.08.07 22:12 
Zitat:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NULL
LIMIT 0, 30' at line 1



geht ned!
Philipp_Reitter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: Mo 13.08.07 22:14 
ahhh hab ein = reingetan jetzt gehts
danke!!!!!!!!!!!!
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 13.08.07 22:40 
Nur kurz zur Erklärung: MySQL arbeitet mit trinärer Logik (wie eigentlich jede Datenbank), was heißt, dass es neben den Werte wahr und falsch auch noch den Wert "unbekannt" angibt. Und genau diesen Wert "unbekannt" liefert ein Vergleich einer bekannten Zahl mit einem unbekannten Argument (was eigentlich ganz logisch ist, auch mit binärer Logik ;-)).
Eine Datenbank liefert aber immer nur Datensätze, von denen es mit trinärer Logik auf eine wahre aussage kommt.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.