Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8354607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:35:52+00:00 2026-06-09T09:35:52+00:00

What causes a query of joined tables to display duplicate data. I have tried

  • 0

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.)
enter image description here

the results i expect from this query is: (screenshot)
enter image description here

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.

enter image description here

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:35:54+00:00Added an answer on June 9, 2026 at 9:35 am

    Actually, there are no duplicates. The 3 “repeated” records each has a different id value. (65,66,67) which makes each one unique. If you remove img.id from the SELECT clause and add a DISTINCT, it will remove the “repeated” records.

    select distinct
    pov.products_options_values_id,
    pov.products_options_values_name,
    pov.color_code,
    inv.model,
    inv.quantity
    from products_options_values as pov
       . . .
    where img.products_id = '301'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query with about 6-7 joined tables and a FREETEXT() predicate on
Why does lean_users show NULL in the ref column? This causes my query to
I'm having two tables, I need to select some data joined from both of
I have the following Query and i need the query to fetch data from
I have a view where one of the joined columns is nullable but is
The RIGHT JOIN on this query causes a TABLE ACCESS FULL on lims.operator .
I have the following query with many LEFT JOIN clauses that has 7 result
Link with data-rel=back causes two (double) back transitions instead of a single. The issue
I have a huge query which uses case/when often. Now I have this SQL
I have some sql that gathers product information. It also retrieves images from joined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.