Getting duplicates returned from db
Posted: Fri Dec 30, 2005 11:37 am
I am making a new directory and I now have 3 tables set up...
directory - contains all info relating to the company listed
cat - contains all available categories
dircat - contains information relating the two above tables to eachother
Now I've created this query to select only categories that have one or more listings in them, but it returns duplicates of the same category (because there are more than one listing with that category) How would I make mysql not return duplicates of the same category?
If there is no way to make mysql return this... is there a convenient php function that will find all duplicate values and delete them from the return array?
directory - contains all info relating to the company listed
cat - contains all available categories
dircat - contains information relating the two above tables to eachother
Now I've created this query to select only categories that have one or more listings in them, but it returns duplicates of the same category (because there are more than one listing with that category) How would I make mysql not return duplicates of the same category?
Code: Select all
SELECT cat.cat_id, cat.cat_category
FROM cat, dircat
WHERE cat.cat_id = dircat.cat_id