Einzelnen Beitrag anzeigen

Benutzerbild von p80286
p80286

Registriert seit: 28. Apr 2008
Ort: Stolberg (Rhl)
6.659 Beiträge
 
FreePascal / Lazarus
 
#12

Re: [Anfägerfrage] wofür ist Group By gut?

  Alt 6. Aug 2009, 12:32
Zitat von Blup:
Die Feldliste im Select muss nicht alle Felder aus dem GroupBy enthalten.
Ob das sinnvoll ist, ist eine andere Frage.
Äh warum? Wodurch ist das begründet?
SQL-Code:
select 'dummy',substr(coddos,1,1),count(idedos)
from tabdos
group by substr(coddos,1,1)
das funktioniert, aber wohl nur wenn es sich um eine Konstante ('dummy') handelt!?

Hier gibt's Mecker:
SQL-Code:
select substr(coddos,1,1),count(idedos)
from tabdos
where substr(coddos,1,1)='H'
Gruß
K-H
  Mit Zitat antworten Zitat