thanks your for your replies - where I'm stuck is how to get the number of records for each reg_id
my table is this :
CREATE TABLE `actu_mail` (
`actum_id` int(11) NOT NULL auto_increment,
`actum_prenom` tinytext NOT NULL,
`actum_nom` tinytext NOT NULL,
`actum_email` tinytext NOT NULL,
`reg_id` smallint(6) NOT NULL default '0',
`func_id` smallint(6) NOT NULL default '0',
`actum_org` tinytext NOT NULL,
`actum_addr` tinytext NOT NULL,
`actum_abb` tinyint(4) NOT NULL default '0',
`actum_exported` tinyint(4) NOT NULL default '0',
KEY `actum_id` (`actum_id`)
)
and the query code that i tried it with is this :
[code=php]$query = "SELECT *, COUNT(*) AS times FROM actu_mail GROUP BY reg_id DESC";
$res2 = mysql_query($query);
while($row2 = mysql_fetch_array($res2)){
$reg_id = $row2['reg_id'];
$regArray[$reg_id]["count"]++;
echo "<br />".$reg_id;
}[/code]
this outputs a descending list of reg_id but it's not in the order of the reg_id with most records gong down to the reg_id with least records - also i don't know how to get the number of records for each reg_id