Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove duplicate results

Status
Not open for further replies.

pheos2

Technical User
Jul 22, 2003
19
GB
Hi,
I have a news system on my site running on php/mysql and want to be able to list news articles by the date they are posted.
I want a list box containing all the available dates. The user would select the date they want, click submit and be able to view the list of articles for that date.

I have the list box setup which gets its values from the database and a simple form to pass on the chosen date but at the moment there are multiple instances of the same date appearing in the list box.

(To simplify this example I’m just using 1 digit dates)

The database contains the dates: 1,1,1,1,1,2,2,3,3,3,3,3,4,5,5,6,7.

I want the list box to show 1,2,3,4,5,6,7

I have found examples of how to remove duplicate entries directly from the database, but that’s not what I want.

Can anybody suggest a way to prune out duplicate values?

Many Thanks
 
select DISTINCT(fieldname) from Table


Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top