sry aber das ist unmöglich - order hat keinen Einfluss auf die Anzahl sondern nur auf die Reihenfolge. Ist das feld der orderklausel denn überhaupt vorhanden ? Lässt Du Dir mysql_error() anzeigen ?
Hey,
ich hab ein Problem mit folgender SQL-Abfrage:
Bei dieser Abfrage kommt kein Ergebniss raus obwohl mind. zwei Datensätz dabei rauskommen sollten!Code:SELECT * FROM invoice WHERE storeid = 123456 AND state = 'VALID' AND isdeleted = 'N' ORDER BY invoiceid DESC LIMIT 0, 100
Sobald ich das ORDER BY wegnehme funktionierts tadellos!
Kann mir da bitte jemand helfen?!?
lg
Flow
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
sry aber das ist unmöglich - order hat keinen Einfluss auf die Anzahl sondern nur auf die Reihenfolge. Ist das feld der orderklausel denn überhaupt vorhanden ? Lässt Du Dir mysql_error() anzeigen ?
TYPO3 · MySQLDumper · dislabs
·
manche Mühlen mahlen schneller ...
"Ich habe Rücken"
Horst Schlämmer
Ich weiß selber dass das nicht wirklich möglich ist, aber es ist so!
Error bekomm ich keinen, nur ein leeres Ergebniss!
Und ich habs nicht nur über PHP sondern auch über den MySQLFront-Client und auf dem Server direkt versucht!
Überall das gleiche, mit ORDER BY bekomm ich ein leeres Ergebniss, ohne bekomm ich zwei Datensätze!
Frag mich nicht warum!
P.S.: Ja, das Feld gibt es!
lg
Flow
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Hab jetzt rausgefunden das es 1.) mit GROUP BY geht aber nicht mit ORDER BY und 2.) ein Datensatz anscheinend entscheident ist!
Dieser gennate Datensatz soll nicht angezeigt werden da er als "state" nicht 'VALID' (wie in der Abfrage gewünscht) sondern 'CANCELED' ist. Das Feld state ist vom Typ enum. Sobald ich den Wert bei diesem Datensatz wieder auf 'VALID' setzte läßt sich die Abfrage auch mit ORDER BY ausführen!!
![]()
![]()
Keine Ahnung was das soll
![]()
![]()
![]()
lg
Flow
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
da ist aber was faul, da auch ENUM-Felder ganz normal abgefragt werden.
Entspricht der Wert in diesem Datensatz auch genau der ENUM-Angabe ?
Irgendwo muss ein Fehler sein, denn mit ORDER kann das nichts zu tun haben.
TYPO3 · MySQLDumper · dislabs
·
manche Mühlen mahlen schneller ...
"Ich habe Rücken"
Horst Schlämmer
Der Wert in dem Feld und der der abgefragt wird sind beide ident!
Ich steht echt vor einem Rätsel, es ist mit vollkommen schleierhaft wie das passiert!
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Hast Du mal einen Dump von der Tabelle, damit ich das mal nachvollziehen kann ?
TYPO3 · MySQLDumper · dislabs
·
manche Mühlen mahlen schneller ...
"Ich habe Rücken"
Horst Schlämmer
Vielleicht ist die Datenbank kaputt? Schonmal versucht sie optimieren zu lassen?
class GetProfileCustomerEntityReceiverInformationReceiverAndProgrammingInforma...{
public function __construct(){ if(!$this) die(' '); } }
http://www.thedailywtf.com/
das kann auch sein. Auf jeden Fall mach mal ein Backup und spiel es Dir lokal ein - ich wette, das dort der Fehler nicht auftritt
Oder liegt es an der externen Verbindung ? **stocher im Nebel**
TYPO3 · MySQLDumper · dislabs
·
manche Mühlen mahlen schneller ...
"Ich habe Rücken"
Horst Schlämmer
Ich hab jetzt mal den betroffenen Datensatz gekillt und versucht den Fehler zu reproduzieren, bis jetzt ist es mir nicht gelungen! Ich meld mich falls ich es doch noch schaffe!
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
So, jetzt is es wieder soweit, das gleiche Spiel nochmal! Nur statt null zeigt er mir 1 Datensatz an obwohl es zwei sind die auf das Kriterium passen!
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
OK, ich bin jetzt drauf gekommen das alle Datensätze die nach dem "gelöschten" (sprich state = CANCELED) gespeichert werden ignoriert werden.
Sprich ich hab z.B. drei Datensätze, wenn ich den mit id 1 "lösche", werden 2 und 3 nicht mehr angezeigt, wenn ich 2 "lösche" wird 1 angezeigt 3 aber nicht, usw. !!!
Das alles solang das ORDER BY gemacht wird!
Jaja, es ist unmöglich das es am ORDER BY liegt, aber das ist nun halt mein einziger Punkt wo sich eine verbesserung bzw. verschlechterung einstellt!
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Wenn es eine so einfache Struktur und Abfrage ist, und Du jeden anderen Fehler ausschliessen kannst, tippe ich immernoch auf eine kaputte Datenbank.
Mach doch mal nen CHECK TABLE `foo`.
class GetProfileCustomerEntityReceiverInformationReceiverAndProgrammingInforma...{
public function __construct(){ if(!$this) die(' '); } }
http://www.thedailywtf.com/
Nein, Tabelle is OK, CHECK TABLE gibt OK zurück!
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Nur zur Erklärung: state ist ein enum-Feld mit den 4 möglichen Werten VALID, CREATED, CANCELED und ABORT !!
Wenn ich statt state = 'VALID', state != 'CANCELED' AND state != 'CREATED' AND state != 'ABORT' nehme funktioniert es!![]()
![]()
Aber WARUM is mir ein Rätsel!!!
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)