> When I execute the following query I get duplicate > product_id's as shown > below: > > SELECT * FROM product, product_category_xref, category WHERE > product_parent_id='' > AND product.product_id=product_category_xref.product_id > AND category.category_id=product_category_xref.category_id > AND product.product_publish='Y' > AND product.product_special='Y' ORDER BY product_name DESC\G > > > Results ( As you can see product_id 4139 occurs twice and I desire the > product_id's to be unique in this query) > > I have also included the descriptions of the tables. > > I would appreciate someone assisting me with a query that > works correctly.
Product 2139 has two different categories BOOKS and EDUCATION and therefore appears twice. category_id: 7920cfab5c630ca88ceabcfda6b3848d product_id: 4139 product_list: NULL category_id: 7920cfab5c630ca88ceabcfda6b3848d vendor_id: 1 category_name: BOOKS category_id: 4ee8c8513ee84c95c8eb7f24e63d7222 product_id: 4139 product_list: NULL category_id: 4ee8c8513ee84c95c8eb7f24e63d7222 vendor_id: 1 category_name: EDUCATION If you need to show all the categories you will probably need to retrieve thos separately and build a list programatically to give something like categories: EDUCATION, BOOKS -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]