Mailinglisten-Archive |
Hallo Guenther,
> -----Original Message-----
> From: Guenther Sendatzki [mailto:guenther.sendatzki at bit-instruments.com]
> ich komm nicht weiter, da ich leider keinen Plan
> von SQL habe:
> Eine einfache Tabelle:
>
> Gerät | handle
> 1 | 500
> 2 | 501
> 3 | 503
> 2 | 504
> 2 | 506
> 3 | 705
>
> jetzt brauche ich eine Abfrage die mir sagt
>
> Gerät 1 kommt 1mal vor
> Gerät 2 kommt 3 mal vor
> Gerät 3 kommt 2 mal vor
ungefähr so:
Select concat('Gerät ',Gerät,' kommt ', count(handle),' mal vor')
from tabelle
group by gerät
bzw.
Select Gerät,count(handle)
from tabelle
group by gerät
Kleine Anmerkung:
Als Spaltennamen und Tabellennamen würde ich nach Möglichkeit keine Umlaute
verwenden. Also lieber "Geraet".
Grüße
Michael Donning
--
Infos zur Mailingliste, zur Teilnahme und zum An- und Abmelden unter
-->> http://www.4t2.com/mysql
php::bar PHP Wiki - Listenarchive