What causes a query of joined tables to display duplicate data. I have tried group by and it just groups one column and displays the same data for other columns making it useless and distinct wont work. Here is the query that i am running. I have extracted the 3 tables that this query is being run from and its located here: http://pastie.org/4413153
Here is the query:
select
pov.products_options_values_id,
pov.products_options_values_name,
pov.color_code,
inv.model,
inv.quantity,
img.id
from products_options_values as pov
left join tbl_inventory as inv
on pov.products_options_values_id = inv.color_id
inner join products_images img
on img.products_id = inv.products_id
where img.products_id = '301'
here is a screenshot of the output. (notice 3 records being printed 3 times each.)

the results i expect from this query is: (screenshot)

here is a screenshot of the page where this query will be added.
Sorry the screenshot wont match what i am trying to do but you’ll get
the picture.

the color names will be used in the select dropdown and the associated color hex values will be used in the colored boxes. the purpose of these boxes are when you mouse over it the image on the left will change to the image id’s value that i mentioned needs to be in the query. there is a ajax call that grabs that image ids value and displays its associated image on the left side.
the purpose of tbl_inventory and its quantity count is that if there is a quantity of 0 of a specific color then the color and its associated hex will not be visible on the dropdown or the box.
Actually, there are no duplicates. The 3 “repeated” records each has a different
idvalue. (65,66,67) which makes each one unique. If you removeimg.idfrom the SELECT clause and add a DISTINCT, it will remove the “repeated” records.