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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:23:18+00:00 2026-06-05T16:23:18+00:00

I have this two tables: Table A ID TYPE SDATE EDATE RATING 1 M

  • 0

I have this two tables:

Table A

ID  TYPE    SDATE   EDATE   RATING

1   M   1/1/2010    1/1/2011    A
1   M   1/3/2010    1/4/2011    B
2   A   7/2/2010    1/31/2015   C
3   M   3/1/2011    1/20/2012   B
4   A   3/1/2011    1/20/2012   B
5   M   3/1/2009    3/1/2009    F
6   M   12/31/2006  12/31/9999  A
7   A   1/1/2006    12/31/9999  B

Table B

ID  TYPE    SDATE   EDATE   RATING

1   M   1/1/2010    1/1/2011    A
2   A   7/2/2010    1/31/2015   C
2   A   9/2/2010    1/31/2015   C
3   M   3/1/2011    1/20/2012   B
4   A   3/1/2011    1/20/2012   C
6   M   12/31/2006  12/31/2015  A
7   A   2/1/2006    12/31/9999  B
8   M   1/2/2010    1/2/2012    

When I perform a table A minus table B, it gets me the next result:

ID  TYPE    SDATE   EDATE   RATING

1   M   1/3/2010    1/4/2011    B
4   A   3/1/2011    1/20/2012   B
5   M   3/1/2009    3/1/2009    F
6   M   12/31/2006  12/31/9999  A
7   A   1/1/2006    12/31/9999  B

I have already identified the case where A.id is not in B.id, but how do I check when it is different in some other column?

I’m not allowed to create anything on the schema, so I have to do it through queries.

So far, this is what I have, but it gives me data that is not correct.



    with aminusb as
    (
        select
            *
        from A
        minus
        select
            *
        from B
    )
    select
        diff.*
    from
        aminusb diff
        ,B
    where
        diff.id = B.id
        and
            diff.start_date = B.start_date
        and
            diff.end_date = B.end_date
        and
            diff.rating <> B.rating


Do you know how could I get the different scenarios?

  • When everything is equal but, rating.
  • When everything is equal but, end date.
  • When nothing is equal but, it has the same id.

I need to get a list of the records that fulfill every scenario so people can check it on detail.

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-05T16:23:20+00:00Added an answer on June 5, 2026 at 4:23 pm

    This would give uncommon rows:

     Select startdate, enddate, rating 
       from TableA 
    Intersect 
     Select startdate, enddate, rating 
       from TableB
    

    To Show All records:

     Select TableA.startdate, TableA.enddate, TableA.rating
      from TableA 
    UNION 
     Select startdate, enddate, rating 
     from TableB
    

    Case 1:

     Select TableA.*, TableB.* 
       from tableA,TableB 
      Where TableA.StartDate = tableB.StartDate  
        And tableA.Enddate=TableB.Enddate 
        And TableA.Rating <>TableB.Rating
    

    And TableA.Rating = TableB.Rating

    Case 2:

     Select TableA.*, TableB.*
       from tableA,TableB 
      Where TableA.StartDate = tableB.StartDate 
        And tableA.Enddate<>TableB.Enddate
        And TableA.Rating = TableB.Rating
    

    Case 3:

     Select TableA.*, TableB.* 
       from tableA,TableB 
      Where TableA.StartDate <> tableB.StartDate 
        And tableA.Enddate<>TableB.Enddate 
        And TableA.Rating <>TableB.Rating
        And TableA.ID =TableB.ID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using luasql. I have two tables of this type: IPINFO CREATE TABLE
I have two tables which looks something like this Table Queue int ID; string
I have two tables associated by FK. Table student is mapped like this: @Entity
I have two tables Department and Employee . Department table looks like this: ID
I have two tables: a Files table, which includes the file type, and a
I have two tables like of this structure: content (content_id, content_type, user_id, time, comment_count)
I have this two tables from my program to manage stock: Articulos (items): id_articulo
I have two tables: This is table1: product_id|product_desc|product_name|product_s_desc This is table2: product_price_id|product_id|product_price Now I
I have two table like this table_CN (_id, name, phone, favorite, title) table_EN (_id,
So I have two tables students (PK sID) and mentors (PK pID). This query

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.