Hi all, I have a query which is selecting DISTINCT sizes from my database only it doesn't seem to be returning DISTINCT sizes. My query is below along with a screen grab of what the query is returning. Appreciate any help
SELECT DISTINCT sizes FROM products AS p LEFT JOIN
products_to_section as o ON p.id=o.prod_id WHERE o.section_name='all-accessories'
there are likely some extraneous spaces or other non-printable characters
do a dump of those rows and show us the INSERT statements
by the way, you want to use INNER JOIN, not LEFT OUTER JOIN
by using LEFT OUTER JOIN, you're saying that there might be rows in products_to_section that have a prod_id for a product that doesn't exist
Hey bud, you were absolutely correct, there was a few nasty spaces on the sizes, very annoying. Gone through them all now and removed any spaces and all is working perfectly. I'll be sure to use the PHP trim function next time to strip any spaces.
Right ok, I'll take a look into using INNER JOIN. Thanks for the pointer