pqrzn7: SQL Überschriften

Beitrag lesen

Hallo. Habe folgendes Problem:

Datensatz:
SQL Tabelle Ueberschrift
id     name
id 1 : Überschrift 1
id 2 : Überschrift 2

SQL Tabelle Untergruppe
id     text      Ueberschriften_Nr.
id 1 : Text 1    1
id 2 : Text 2    1
id 3 : Text 3    2
SQL Abfrage:
<?php 
$command = "SELECT * FROM Ueberschrift ue, Untergruppe u WHERE ue.id = u.Ueberschriften_Nr.";
$data = database :: getInstance()->sql($command, array($ueberschrift_id))?>

Ausgabe:
<?php while($row = $data->nextRow()) { ?>
<tr>
<th><?php echo ($row->ueberschrift);?></th>
</tr>
<tr>
<td><?php echo ($row->text);?></td>
</tr>
<?php } ?>

So viel da zu.

Ausgabe im Browser ist folgende:

Überschrift 1
Text 1

Überschrift 1
Text 2

Überschrift 2
Text 3

Jetzt möchte ich allerdings die Überschriften logischerweise nur jeweils ein mal. Söllte also das bei raus kommen:

Überschrift 1
Text 1
Text 2

Überschrift 2
Text 3

Habe jetzt schon rumgesucht usw. aber komme einfach nicht drauf. Hilfe? Hödödö?