Hi guys, I have this table schema: id | type | lang ------------------------ 01 | article | en 02 | article | ja 03 | blog | en 04 | blog | fr And am trying to generate this report: type | lang | count ------------------------ article | en | 100 article | ja | 200 blog | en | 300 blog | fr | 200 I thought it would be simple but it's proving to be beyond my skill set. Any help you could offer would be appreciated.
Wrong. Here is the right way, this is untested but should work. $sql = mysql_query('SELECT `type`,`lang`,count(*) FROM `TABLENAMEHERE` GROUP BY `lang`,`type`') or die(mysql_error()); if (mysql_num_rows($sql)) { die('no results'); } else { while($r = mysql_fetch_row($sql)) { $type = stripslashes($r[0]); $lang = stripslashes($r[1]); $count = $r[2]; /* put something here to perform or display. */ } } PHP: