Einzelnen Beitrag anzeigen

nahpets
(Gast)

n/a Beiträge
 
#4

AW: Group BY mit Zusammenfassung

  Alt 7. Sep 2015, 17:03
Das sieht mir jetzt nicht unbedingt nach Group By aus.

Meinst Du eher sowas?
Code:
select Sum(Kein Spaltename) As Summe, Status from tabelle where status = 10 group by status
union all
select Sum(Kein Spaltename) As Summe, Status from tabelle where status <> 10 group by status
Zeig mal bitte das reale Statement mit dem Group by, dass es eine Tabelle mit 'ner Spalte Namens (Kein Spaltenname) gibt, glaub' ich jetzt erstmal nicht.

Enthält kein Spaltenname eigentlich die Anzahl der Sätze zum Status oder die Summe der Werte zum Status?
Code:
select Count(*) as Anzahl, Status from tabelle where status = 10 group by status
union all
select Count(*) as Anzahl, Status from tabelle where status <> 10 group by status

Geändert von nahpets ( 7. Sep 2015 um 19:50 Uhr)
  Mit Zitat antworten Zitat