Autor Beitrag
JungerIslaender
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Do 01.10.09 16:45 
Ich habe folgende abfrage:
ausblenden Quelltext
1:
mysql_query("SELECT * FROM egal ORDER BY egal");					


Wie frage ich jetzt nur tabellen ab die nicht leer sind?

Denn das funktioniert nicht:

ausblenden Quelltext
1:
mysql_query("SELECT * FROM egal WHERE egal<>"" ORDER BY egal");					
Muck
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98
Erhaltene Danke: 8

Win 8, Win 7, Vista, Win XP
Delphi XE3, Delphi 2009, Delphi 2007, Delphi 5
BeitragVerfasst: Do 01.10.09 17:18 
Hallo,

versuche es mit

ausblenden Quelltext
1:
 mysql_query("SELECT * FROM egal WHERE length(egal)>0 ORDER BY egal");					
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Do 01.10.09 17:21 
ausblenden SQL-Anweisung
1:
WHERE egal IS NOT NULL					

_________________
PROGRAMMER: A device for converting coffee into software.
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Do 01.10.09 17:25 
user profile iconMuck hat folgendes geschrieben Zum zitierten Posting springen:
Hallo,

versuche es mit

ausblenden Quelltext
1:
 mysql_query("SELECT * FROM egal WHERE length(egal)>0 ORDER BY egal");					


Jo funktioniert danke. Es muss allerdings

ausblenden Quelltext
1:
 mysql_query("SELECT * FROM egal WHERE length(egal)<>0 ORDER BY egal");					


sein. <> Für ungleich.

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

user profile iconXentar hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden SQL-Anweisung
1:
WHERE egal IS NOT NULL					


Das funktioniert nicht. ???
Muck
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98
Erhaltene Danke: 8

Win 8, Win 7, Vista, Win XP
Delphi XE3, Delphi 2009, Delphi 2007, Delphi 5
BeitragVerfasst: Do 01.10.09 17:29 
Hallo,

nur zur Information:

Die Frage nach "NOT NULL" wird Strings mit der Laenge Null also "" trotzdem anzeigen. Kommt also drauf an was man will.
Schreibst Du ein "" in ein Feld so ist es nicht mehr NULL.

bis denne
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 01.10.09 17:32 
user profile iconJungerIslaender hat folgendes geschrieben Zum zitierten Posting springen:
Es muss allerdings

ausblenden Quelltext
1:
 mysql_query("SELECT * FROM egal WHERE length(egal)<>0 ORDER BY egal");					


sein. <> Für ungleich.
Eine negative Länge ist doch irgendwie unwahrscheinlich, daher sollte das eigentlich äquivalent sein. ;-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Do 01.10.09 17:39 
user profile iconChristian S. hat folgendes geschrieben Zum zitierten Posting springen:
user profile iconJungerIslaender hat folgendes geschrieben Zum zitierten Posting springen:
Es muss allerdings

ausblenden Quelltext
1:
 mysql_query("SELECT * FROM egal WHERE length(egal)<>0 ORDER BY egal");					


sein. <> Für ungleich.
Eine negative Länge ist doch irgendwie unwahrscheinlich, daher sollte das eigentlich äquivalent sein. ;-)


OK da hast du recht. :D

@Muck Leere felder sollen nicht angezeigt werden daher erstere Lösung.

Danke für die schnelle Hilfe.
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: Fr 02.10.09 08:28 
Also so ...
user profile iconJungerIslaender hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Quelltext
1:
mysql_query("SELECT * FROM egal WHERE egal<>"" ORDER BY egal");					

... seh ich da nur nen Syntax-Fehler im PHP-Source ...
ausblenden Quelltext
1:
mysql_query("SELECT * FROM egal WHERE egal<>'' ORDER BY egal");					


Und für den Unterschied zwischen '' und is null konsultiere man bitte einen Oracle-Entwickler (oder alternativ das MySQL-Handbuch).

_________________
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.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Fr 02.10.09 08:46 
Edit:
Text gelöscht - sorry BenBE ;)

_________________
PROGRAMMER: A device for converting coffee into software.