Hi guys,
Working on a table.
Each of the entries has an A or B in the 'tip' field.
I order them by 'tip'
how can i add a special row for the first entry of the A or B series from the query?
I know it's not an IF
Example:
ENTRY TIME
A 231 name1 3:23
A 123 name2 4:23
A 123 name3 5:23
A 123 name4 6:23
A 123 name5 7:23
A 123 name6 8:23
A 123 name7 9:23
EXIT TIME
B 124 name8 10:23
B 125 name9 11:23
B 126 name10 12:23
B 127 name11 13:23
B 128 name12 14:23
B 129 name13 15:23
B 130 name14 16:23
B 131 name15 17:23
$raport_zi = mysql_query("SELECT u.name, SEC_TO_TIME(AVG(TIME_TO_SEC(p.ora))) as timp, u.user, p.tip FROM utilitar.pontaj as p
INNER JOIN utilitar.pontaj_usr as u ON u.user = p.user
WHERE p.tip = 'A'
AND p.data >= '2012-02-01'
GROUP BY p.user
ORDER BY u.name ASC");
$output = '<table>';
$output .= '<tr><th>Nume</th><th>Ora</th></tr>';
while($row = mysql_fetch_array($raport_zi))
{
$output .= '<tr><td>'.$row['name'].'</td><td>'.$row['timp'].'</td></tr>';
}
$output .= '</table>';