I need to group a query with a detail, grouping should be done only when the information is repeated in sequence, for example:
id nome
1 lucas
2 lucas
3 marcos
4 lucas
5 marcos
In the example above, only the "lucas" with ID's 1 and 2 can be grouped, the other information not, since they are not in sequence.
The following is an excerpt from the query:
$SQL = "select * from clientes where id = '".$id."' group by nome order by id desc ";
$RSS = mysql_query($SQL, $conexao);
while($RS = mysql_fetch_array($RSS)){
echo $RS["nome"]."<br>";
}