![]() |
Re: Problem mit Query
Liste der Anhänge anzeigen (Anzahl: 1)
Habe das in FB getestet da macht die Abfrage, was sie soll :gruebel:
|
Re: Problem mit Query
Sehr seltsam.
Vielleicht liegt es daran, dass MySQL nichts mit a.count(ID) anfangen kann? (ERROR 1305: FUNCTION a.count does not exist) |
Re: Problem mit Query
Sorry der Alias gehört natürlich in die Klammer
SQL-Code:
SELECT a.voting_text, count(a.ID) AS ergebnis FROM ( Select voting_text, MAX( ID) as ID from data group by voting_ip, voting_text) a group by a.voting_text;
|
Re: Problem mit Query
Also bei mir sieht es jetzt so aus:
SQL-Code:
geändert von mir wurde lediglich das
mysql> SELECT a.voting_text, count(a.ID) AS ergebnis FROM ( Select voting_text, MAX(voting_id) as ID from data group by voting_ip, voting_text) a group by a.voting_text;
SQL-Code:
weil wenn ich nur MAX(ID) hier nehme bringt er den Fehler "Unknown column 'ID' in 'field list'"
MAX(voting_id) as ID ...
Auf jeden Fall bringt "mein" SQL nicht den gewünschten Effekt. Im Übrigen möcht ich mich schon mal für den Einsatz bedanken! Find ich echt toll! Danke! |
Re: Problem mit Query
Führe mal nur die innere Abfrage aus und lass dir das Ergebnis anzeigen
|
Re: Problem mit Query
Das hier:
Code:
+-------------+------+
| voting_text | ID | +-------------+------+ | Ja | 2 | | Ja | 1 | | Nein | 3 | +-------------+------+ |
Re: Problem mit Query
Wie sieht die komplette Tabelle dazu aus?
|
Re: Problem mit Query
so:
Code:
+-----------+---------------------+-------------+-----------+
| voting_ip | voting_date | voting_text | voting_id | +-----------+---------------------+-------------+-----------+ | 10.0.60.1 | 2008-04-21 11:43:00 | Ja | 1 | | 10.0.60.2 | 2008-04-21 11:40:00 | Ja | 2 | | 10.0.60.1 | 2008-04-21 15:13:00 | Nein | 3 | +-----------+---------------------+-------------+-----------+ |
Re: Problem mit Query
Ok. Ich Gruppiere ja nach Text und ID
SQL-Code:
SELECT a.voting_text, count(a.ID) AS ergebnis FROM
(select c.voting_text, MAX(b.voting_id) as ID from data b join data c on c.id = b.ID group by voting_ip) a group by a.voting_text; |
Re: Problem mit Query
ERROR 1054 (42S22): Unknown column 'c.id' in 'on clause'
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:23 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz