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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:32:48+00:00 2026-06-01T07:32:48+00:00

I want to compare fields in 2 tables to see if the fields have

  • 0

I want to compare fields in 2 tables to see if the fields have the same values.

For e.g.

– I have 2 tables, ‘products’ and ‘wishlist’.

– In both tables, they have the same fields ‘prodId’ and ‘userId’, plus other fields like ‘title’, etc.

– The ‘wishlist’ table contains some of the same rows that are in table ‘products’
(e.g. 10 in total in ‘products’ but only 6 of the same rows are in table ‘wishlist’)


– I want to display the fields/rows from table ‘products’, that are different from table ‘wishlist’, so from the e.g. it will only show 4 (so it does not show duplicates of the 6),
so to do this I would like to use fields ‘prodId’ and ‘userId’, in the table ‘products’, and compare this to the same fields in the table ‘wishlist’.

How would I do this?

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-06-01T07:32:49+00:00Added an answer on June 1, 2026 at 7:32 am

    A JOIN will return you all records that have matching values in both tables:

    SELECT *
    FROM
        products p
        JOIN wishlist w ON w.userId = p.userId AND w.prodId = p.prodId
    

    JOIN


    EDIT:

    To return all records that are not matching:

    SELECT *
    FROM
        products p
        FULL OUTER JOIN wishlist w ON w.userId = p.userId AND w.prodId = p.prodId
    WHERE
        p.Id IS NULL
        OR w.Id IS NULL
    

    FULL OUTER JOIN


    EDIT:

    To show records in products that don’t have a match in wishlist, use a LEFT JOIN:

    SELECT *
    FROM
        products p
        LEFT JOIN wishlist w ON w.userId = p.userId AND w.prodId = p.prodId
    WHERE
        w.Id IS NULL
    

    LEFT JOIN

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

Sidebar

Related Questions

I want to compare them: both of gems have advantages and disadvantages. For example
I have two tables and want to compare rows on sqlite like this table1
I have two tables that I need to compare and update values in one
I have a DateTime object I want to compare against an sql datetime field
I want to compare two strings for equality when either or both can be
I have table a and table b . (SQL Server 2008) Both tables have
I have two tables with identical structures handling distinct data. I want to merge
I have a SQL statement that I want to return 6 fields found from
I want to compare some floating values . To do,my query is like :
I want to compare a column in table a and table b If the

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.