Ich habe eine Spalte 'Stunde' Ich habe eine Spalte 'Art' (es kann 1,2 oder 3 sein)
Ich möchte etwas tun wie:
SELECT count(id), SUM(hour) as totHour, SUM( IF ( kind = 1, 1, 0 ) ) as countKindOne
oder
SELECT count(id), SUM(hour) as totHour, COUNT( IF ( kind = 1 ) ) as countKindOne
Aber MySQL sagt mir, ich habe einen Fehler ... was ist der Fehler!?
Weitere Informationen finden Sie in diesem Thema zum Stapelüberlauf: MySQL SUM IF Feld b = Feld a
.. Ich kann das nicht beantworten ...
SUM(IF(o.id < 500000, 1, 0)) AS imported