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

  • Home
  • SEARCH
  • 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 347777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:18:12+00:00 2026-05-12T11:18:12+00:00

I am selecting everything from prod_drop and joining 2 other tables for additional data.

  • 0

I am selecting everything from prod_drop and joining 2 other tables for additional data. I do not want any of the rows from prod_drop to be repeated, I just want 1 row for each prod_drop row.

Here is my query:

SELECT 
    prod_drop.*
    , prod_drop_products.product_id
    , cart_product.product_image_sm 
FROM 
    prod_drop   
LEFT JOIN 
    prod_drop_products 
ON 
    prod_drop.prod_drop_id = prod_drop_products.prod_drop_id 
LEFT JOIN 
    cart_product 
ON 
    prod_drop_products.product_id = cart_product.product_id 
ORDER BY 
    prod_drop_id 
DESC

These are the results:

prod_drop_id    prod_drop_name  prod_drop_available product_id  product_image_sm
51  Carat Weight    yes 4971    S5-3515Y_S.jpg
51  Carat Weight    yes 4970    S5-3515Y_S.jpg
51  Carat Weight    yes 4969    S5-3515Y_S.jpg
50  Carat Weight    yes 4959    S5-3515_S.jpg
50  Carat Weight    yes 4960    S5-3515_S.jpg
50  Carat Weight    yes 4958    S5-3515_S.jpg
49  Metal Quality   yes 3269    Q-8785X-14_S.jpg
49  Metal Quality   yes 3270    Q-8785X-14_S.jpg
48  Gold Color  yes 1635    1390-Y_S.jpg
48  Gold Color  yes 1390    PE0048-12W_S.jpg

But I only want one row per prod_drop_id (doesn’t matter which) so essentially I want my results to be like this:

prod_drop_id    prod_drop_name  prod_drop_available product_id  product_image_sm
51  Carat Weight    yes 4971    S5-3515Y_S.jpg
50  Carat Weight    yes 4959    S5-3515_S.jpg
49  Metal Quality   yes 3269    Q-8785X-14_S.jpg
48  Gold Color  yes 1635    1390-Y_S.jpg

How can I do that?

Thanks!

  • 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-05-12T11:18:12+00:00Added an answer on May 12, 2026 at 11:18 am

    As you can see from your data, there are clearly more than one record in prod_drop_products for each record in prod_drop. So if you only want one row in the output for each distinct row in prod_drop, then you need to either eliminate the output columns from this table, or decide which of the multiple rows in prod_drop_products you want the output to get it’s value from for the query output columns that are coming from this table ( product_id, specifically) If it doesn’t matter which product_id you output (this doesn;t make sense from a business perspective, but hey…) then you can use Min, or max() whichever you prefer. If it does matter, then please specify what logic you want to use t omake that decision and the query can be edited t oreflect that…

    Assuming Min() is ok, you can:

    SELECT pd.prod_drop_id, pd.prod_drop_name, pd.prod_drop_available,     
      Min(pp.product_id), Min(cp.product_image_sm)
    FROM prod_drop pd 
       LEFT JOIN prod_drop_products pp 
           ON pp.prod_drop_id = pd.prod_drop_id 
       LEFT JOIN cart_product cp
           ON cp.product_id = pp.product_id 
    Group By pd.prod_drop_id, pd.prod_drop_name, pd.prod_drop_available
    ORDER BY prod_drop_id DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 164k
  • Answers 164k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Create an anonymous function which accepts i as a parameter… May 12, 2026 at 12:23 pm
  • Editorial Team
    Editorial Team added an answer If you already implemented a base controller just override its… May 12, 2026 at 12:23 pm
  • Editorial Team
    Editorial Team added an answer To solve this at all reasonably, you need to use… May 12, 2026 at 12:23 pm

Related Questions

I am attempting to analyze an iPhone application using the Leaks application and everything
I'm designing some VB based ASP.NET 2.0, and I am trying to make more
I Have an odd issue with some JavaScript code (again, I hate debugging JS
I'm writing my first app with ASP.NET MVP (attempting Supervisory Controller) and Unit Testing
I am working in a C# winforms project and I have a user control

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.