php.de

Zurück   php.de > Webentwicklung > Datenbanken

Datenbanken SQL und Co

Antwort
 
LinkBack Themen-Optionen Thema bewerten
Alt 02.01.2009, 12:19  
Benutzer
 
Registriert seit: 18.11.2004
Beiträge: 56
Gumfuzi
Standard Impossible WHERE noticed after reading const tables

Hallo Leute,

habe hier eine Abfrage, die ein leeres Resultat ausgibt und beim EXPLAIN kommt dann folgendes:
"Impossible WHERE noticed after reading const tables"
Code:
EXPLAIN EXTENDED SELECT g.game_id, g.game_name, g.game_highscore, g.game_highuser, g.game_highdate, g.game_scoretype, g.game_type, g.game_cost, g.game_reward, g.game_jackpot, g.game_use_jackpot, g.cat_id, s.session_id, s.start_time, s.user_id, u.username, c.cat_name, c.cat_desc, c.cat_desc_uid, c.cat_desc_bitfield, c.cat_desc_options, c.parent_id, c.left_id, c.right_id, c.cat_parents, c.cat_cost, c.cat_reward, c.cat_use_jackpot
FROM (phpbb_arcade_games g)
LEFT JOIN phpbb_arcade_categories c ON ( g.cat_id = c.cat_id )
LEFT JOIN phpbb_arcade_sessions s ON ( g.game_id = s.game_id )
LEFT JOIN phpbb_users u ON ( g.game_highuser = u.user_id )
WHERE g.game_scorevar = 'cubshoot'
AND s.user_id = u.user_id
AND s.user_id =3
alle Spalten im WHERE-Teil sind vorhanden (die gesuchten Begriffe).

Liegts es an einem Spalten-Typ (INT, TEXT, etc.) oder fehlt ein Verweis zw. 2 Tabellen oder woran liegt es?

Vielen, vielen Dank für eure Hilfe!
Gumfuzi ist offline   Mit Zitat antworten
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 02.01.2009, 17:59  
Erfahrener Benutzer
 
Benutzerbild von David
 
Registriert seit: 05.09.2007
Beiträge: 5.044
David wird schon bald berühmt werden
Standard

Kannst Du einen Tabledump mit Testdaten posten?
Also in der Form[code]CREATE TABLE phpbb_arcade_games (...);
CREATE TABLE phpbb_arcade_categories (...);
CREATE TABLE phpbb_arcade_sessions (...);
CREATE TABLE phpbb_users (...);

INSERT INTO phpbb_arcade_games (...) VALUES (...);
INSERT INTO phpbb_arcade_categories (...) VALUES (...);
...[/php]
David ist offline   Mit Zitat antworten
Alt 02.01.2009, 22:49  
Benutzer
 
Registriert seit: 18.11.2004
Beiträge: 56
Gumfuzi
Standard

Danke, ich probiere eben einen anderen Weg aus, sorry.

Falls es nicht klappt, komme ich dankend wieder retour!

Danke vorerst mal!
Gumfuzi ist offline   Mit Zitat antworten
Alt 03.01.2009, 02:05  
Moderator
 
Benutzerbild von Chriz
 
Registriert seit: 11.05.2008
Beiträge: 6.069
Chriz ist ein wunderbarer AnblickChriz ist ein wunderbarer AnblickChriz ist ein wunderbarer AnblickChriz ist ein wunderbarer AnblickChriz ist ein wunderbarer AnblickChriz ist ein wunderbarer AnblickChriz ist ein wunderbarer Anblick
Standard

Ein leeres Resultat bekommst du wenn es eben keine Treffer gibt. Da nur du die Werte, Strukturen und Beziehungen kennst, kann man da schwer helfen.

Grundsätzlich hilfreich ist es, die Bedingungen zu reduzieren, bis Ergebnisse auftauchen. Dann nach und nach die gewünschten Bedingungen hinzufügen und prüfen, ob das Ergebnis mit dem erwarteten übereinstimmt.
Chriz ist offline   Mit Zitat antworten
Alt 03.01.2009, 06:57  
Erfahrener Benutzer
 
Registriert seit: 16.07.2005
Beiträge: 1.007
PHP-Kenntnisse:
Fortgeschritten
brian johnson befindet sich auf einem aufstrebenden Ast
Standard

ich tippe eher, das es an dieser ziemlich sinnlosen bedingung liegt.

Code:
AND s.user_id = u.user_id
AND s.user_id =3
__________________
PHP4?!?>>>Aktuelle PHP Version: 5.2.11 || 5.3.0
Suse 11.2 *vorfreude*
brian johnson ist offline   Mit Zitat antworten
Alt 03.01.2009, 07:01  
Erfahrener Benutzer
 
Benutzerbild von David
 
Registriert seit: 05.09.2007
Beiträge: 5.044
David wird schon bald berühmt werden
Standard

Muss ja nicht sinnlos sein. Es können entsprechende Daten vorliegen.
Die Meldung kommt nur, weil zur Zeit keine entsprechenden Daten vorliegen. Das wird bei EXPLAIN nämlich auch abgetestet.
Zitat:
Impossible WHERE noticed after reading const tables
Code:
CREATE TABLE "blub" (
  "id" tinyint(3) unsigned NOT NULL,
  PRIMARY KEY  ("id")
)
INSERT INTO "blub" ("id") VALUES (1),(2),(3);
dann
Code:
EXPLAIN SELECT
  id  
FROM
  blub  
WHERE
  id=5
und Du bekommst besagtes "Impossible WHERE noticed after reading const tables".

Allerdings wird es sich vermutlich schon auf g.game_scorevar = 'cubshoot' oder s.user_id =3 beziehen, denn sehr "gründlich" testet EXPLAIN die Daten nicht

Geändert von David (03.01.2009 um 07:09 Uhr).
David ist offline   Mit Zitat antworten
Alt 03.01.2009, 10:53  
Benutzer
 
Registriert seit: 18.11.2004
Beiträge: 56
Gumfuzi
Standard

wenn ich diese beiden weglasse, dann findet er den Datensatz:
Code:
AND s.user_id = u.user_id
AND s.user_id =3
aber wie gesagt, ich werde den Code anders gestalten, dann stellt sich diese Abfrage nicht in der Form.

Danke trotzdem für eure Infos.
Gumfuzi ist offline   Mit Zitat antworten
Antwort


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
impossible where noticed after reading const tables, impossible where noticed after reading const table, \impossible where noticed after reading const tables\, impossible where noticed after reading const table..., \impossible where noticed after reading const table\, explain impossible where noticed after reading const tables, impossible where noticed after reading const table., \ impossible where noticed after reading const tables\, impossible where noticed after reading const table.., \'impossible where noticed after reading const tables\', wimpossible where noticed after reading const tablesw, rails has_many impossible where noticed after reading const tables, mysql impossible where noticed after reading const table, impossible where noticed after reading, \ impossible where noticed after reading const tables\, explain impossible where noticed after reading const table..., \impossible where noticed after reading const table...\, \impossible where noticed after reading const tables \, impossible where noticed after reading const, impossible where noticed

Alle Zeitangaben in WEZ +1. Es ist jetzt 18:49 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum