...

View Full Version : MySQL Query without repeating same data



xxkylexx
06-28-2007, 07:54 AM
Hello there,
Each piece of data in my table has a category field associated with it, making multiple items with the same categories. I want to create a MySQL query that will only grab the different categories associated with the data in the table.

example data
Name Field: Picture 1, Category Field: Trip
Name Field: Picture 2, Category Field: Park
Name Field: Picture 3, Category Field: Park
Name Field: Picture 4, Category Field: Trip
Name Field: Picture 5, Category Field: Trip
Name Field: Picture 6, Category Field: Birthday
Name Field: Picture 7, Category Field: Trip
Name Field: Picture 8, Category Field: Birthday

Query would only display: Trip, Park, Birthday


Any ideas?

Thanks!
Kyle

Fumigator
06-28-2007, 08:23 AM
select distinct categoryField from table

or

select categoryField from table group by categoryField



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum