1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
$qry = "CREATE TEMPORARY TABLE temp_detail ";
$qry .= "SELECT id_membres, groupe, sum(points) score, count(p.id_match) nb, SUM(if(points = 5,1,0)) P5, SUM(if(points = 4,1,0)) P4, SUM(if(points = 3,1,0)) P3, SUM(if(points > 0,1,0)) PB
FROM table1 p, table2 m WHERE p.id_match = m.id_match and groupe = $id and m.champ = $champ and m.jour = $jour GROUP BY id_membres ";
$res = $db->sql_query($qry);
$qry = "SELECT pseudo, score, nb, P5, P4, P3, PB FROM table3 LEFT JOIN temp_detail ON id_pseudo = id_membres WHERE equipe = $id ORDER BY score DESC ";
$res = $db->sql_query($qry);
while ($row = $db->sql_fetchrow($res))
{
$a++;
echo "<tr bgcolor=\"#DDEBEE\">
<td align=\"center\"> $a </td>
<td> $row[pseudo] </td>
<td align=\"center\"> $row[score] </td>
<td align=\"center\"> $row[nb] </td>
<td align=\"center\"> $row[PB] </td>
<td align=\"center\"> $row[P5] </td>
<td align=\"center\"> $row[P4] </td>
<td align=\"center\"> $row[P3] </td>
</tr>";
} |
Partager