Page 1 of 1

reduce output from database to exclude duplications.

Posted: Mon Apr 03, 2006 7:33 pm
by Sculpture
Hello all,

I am trying to figure out a way to restrict a query to excude duplications. There is a table that supplies 2 dropdown tables, one for suburbs and another field for postcodes. The administrator can insert new suburbs and postcodes but sometimes several of the suburbs have the same postcodes. Therefore, needless to say, the postcode dropdown ends up with extraneous postcodes.

Code: Select all

mysql_select_db($database_connect_form, $connect_form);
$query_qArea = "SELECT town, postcode FROM areas";
$qArea = mysql_query($query_qArea, $connect_form) or die(mysql_error());
$row_qArea = mysql_fetch_assoc($qArea);
$totalRows_qArea = mysql_num_rows($qArea);
This is the query, I was wondering if there is a formula that I could use with the select statement that would select unique entries.

Thanks

Posted: Mon Apr 03, 2006 7:37 pm
by hawleyjr
distinct()

Posted: Mon Apr 03, 2006 8:29 pm
by Sculpture
Thank you hawleyjr, works a treat. :D