Ich habe die folgende Tabelle:Der richtige Einsatz von MySQL Summenfunktion
Field | Type | Null | Key | Default | Extra |
+-----------------+----------------------+------+-----+---------+-------+
| SMILES | char(200) | NO | PRI | | |
| ConfRank | smallint(5) unsigned | NO | | NULL | |
| CompTime | double | YES | | NULL | |
Ich mag die Gesamt CompTime für ein bestimmtes SMILES erhalten (Comptime für al confrank ein bestimmtes Lächeln bedeutet hinzugefügt).
Ich habe versucht, die folgenden:
SELECT SMILES,(SUM(CompTime)) From GeoAndEnergies GROUP BY ConfRank WHERE SMILES='C';
Und diesen Fehler erhalten:
ERROR 1064 (42000): 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 '
WHERE SMILES='C'
' at line 1
ich auch versucht:
SELECT SMILES,(SUM(CompTime)) From GeoAndEnergies GROUP BY ConfRank WHERE SMILES='C' GROUPBY ConfRank ;
Und ein anderer Fehler erhalten:
ERROR 1064 (42000): 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 '
WHERE SMILES='C' GROUPBY ConfRank
' at line 1
Was wäre die korrekte Syntax?
Perfekt, danke! – Laetis
wo ist Ihr Methodenfeld in Ihrer Tabelle –