Hi
I have a table containing products that i would like to list in alphabetical order (with 'pr_nom') but grouped by category ('fam_id')
the table looks like this :
pr_id smallint(6) NOT NULL auto_increment,
pr_nom tinytext NOT NULL,
pr_prix decimal(4,2) NOT NULL default '0.00',
fam_id smallint(6) NOT NULL default '0',
subfam_id smallint(6) NOT NULL default '0',
pr_desc tinytext NOT NULL,
pr_orig tinytext NOT NULL,
pr_ref tinytext NOT NULL,
unite_id tinyint(4) NOT NULL default '0',
pr_vol varchar(10) NOT NULL default '',
pr_coeur tinytext NOT NULL,
pr_image tinytext NOT NULL,
pr_online tinyint(4) NOT NULL default '0',
KEY pr_id (pr_id,fam_id,subfam_id),
KEY unite_id (unite_id)
if i do
$sql = "SELECT * FROM produits ORDER BY pr_nom";
it works fine and returns a list of products in alpha order, but if i do
$sql = "SELECT * FROM produits GROUP BY fam_id ORDER BY pr_nom";
it just returns 6 results because I have 6 different fam_ids in the table
what do i need to do ?
thanks