MySQL Forums
Forum List  »  German

Re: Tabelle auslesen und Zeilen sortieren
Posted by: Katja Kahl
Date: February 02, 2015 04:11AM

Hallo Andreas,
mein Ansatz wäre folgender:
select land, stadt, count(*) as anzahl
from <table>
group by land, stadt
order by land, stadt;

Die Überschriften würde ich dann in php setzen:
wenn du in der Schleife die Daten ausgibst, dann merke dir das Land in einer extra Variable. Wenn das Land nicht dem SQL-Wert entspricht, dann schreibe zusätzlich zur Zeile mit der Stadt, auch die Überschriftszeile mit dem Land.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Tabelle auslesen und Zeilen sortieren
991
February 02, 2015 04:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.