OK, how about this? $sql = "SELECT DISTINCT(email) FROM $table"; $result = mysql_query($sql,$connection) or die("Couldn't execute query 0."); while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = "SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'"; $result1 = mysql_query($sql1,$connection) or die("Couldn't execute query 1."); echo ' ' . mysql_num_rows($result1) ; } echo $row1 ; > Kinda, but I just wanna count how many views in total... > Hence my $row1++; bit... > I'll have a play with your code though...! > Cheers, > Tris... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php