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 8446655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:59:07+00:00 2026-06-10T09:59:07+00:00

I have the tables PRODUCTS and LISTINGS . When doing the following query: SELECT

  • 0

I have the tables PRODUCTS and LISTINGS. When doing the following query:

SELECT DISTINCT *
FROM products
INNER JOIN listings
ON products.product_number=listings.product_number

This is the “search” functionality:

WHERE products.product_number !='' 
AND listings.monthly_price BETWEEN '0' AND '10'

This returns a double entry of one of the product listings. Why isn’t DISTINCT working?

EDIT

Products:

product_number, make, model model_number, colour, processor, battery_standby, battery_talk, camera, flash, screen_size, screen_res, memory

Listings:

listing_number, featured, date, member_id, network, length, product_number, monthly_price, minutes, texts, data, image1

Essentially I’d like to create result rows matching the listings tables via their PRODUCT_NUMBER to the product table. It’s for a search function of a phone listings website to be more precise.

To be much more specific, the search function uses the products table to search, then the listings table to show the useful information about the phone listing.

ANSWER

SELECT DISTINCT *
FROM listings
INNER JOIN products
ON products.product_number=listings.product_number

The above did the trick; simply swapping the tables round. I also inserted a few more rows into listings, and the “problem” vanished. Even if it’s not solved, it isn’t happening anymore… Not sure what the problem was.

  • 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-10T09:59:08+00:00Added an answer on June 10, 2026 at 9:59 am

    If there is a record where 2 listings joins a single product then this would produce what you are seeing:

    The select distinct is done on the result of the inner join

    I’d use the common join value to select * from each table and see the results

    HTH

    Ian

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my query $db2=mysql_connect(localhost,root,); mysql_select_db(my_requests,$db2); $query=mysql_query(SELECT * FROM details INNER JOIN product ON
I have the following (simplified) database tables: Products - ProductID, int, PK - Name,
I have this three tables: products TABLE: id:integer name:string features TABLE: id:integer name:string features_products
I have 3 tables: products, products_description, products_to_categories Here is my sql: SELECT `products`.`products_model`, `products_description`.`products_name`
I have following tables: products - 4500 records Fields: id, sku, name, alias, price,
I have a problem with a query: I have 3 tables: products (id, name)
A common (i assume?) type of query: I have two tables ('products', 'productsales'). Each
I have the following tables: Products product, idcurrency, value Prod1 1 5000 Prod2 2
Lets say I have the following tables: Customers Products CustomerProducts Is there a way
I have the following tables: Products Categories Subcategories Brands with the following fields: Products:

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.