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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:11:00+00:00 2026-06-12T11:11:00+00:00

I have two tables, table1 and table2 . They both have same columns, program_id

  • 0

I have two tables, table1 and table2. They both have same columns, program_id, scheduled_time and timezone_id.

I want to retrieve the rows whose have same program_id and timezone_id, but have different scheduled_time from table1.

So here is the sql that I tried:

select t1.* 
from table1 t1, table2 t2 
where t1.program_id = t2.program_id 
  and t1.timezone_id = t2.timezone_id 
  and t1.scheduled_time != t2.scheduled_time;

But I still see rows that have same program_id, scheduled_time and timezone_id.

Could someone fix the sql?

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-12T11:11:02+00:00Added an answer on June 12, 2026 at 11:11 am

    Try something like this:

    SELECT
        t1.* 
    FROM
        table1 t1
    INNER JOIN
        table2 t2 ON t1.program_id = t2.program_id AND t1.timezone_id = t2.timezone_id 
    WHERE
         t1.scheduled_time <> t2.scheduled_time
    

    Basically, do an INNER JOIN on the common columns (program_id and timezone_id) and make sure the scheduled_time column has a different value.

    Also: in SQL use the <> operator – != is for C# / VB.NET ….

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

Sidebar

Related Questions

I have two tables table1 and table2 . Both tables have the same structure.
I have two tables - table1 and table2 table1 has 14 columns and table2
I have two tables: table1, table2. Table1 has 10 columns, table2 has 2 columns.
I have two tables table1 = records, table2 = duplicates. Both tables contain a
I have two tables, both have the same columns. We will call them tilistings
There are two tables: table A and table B. They have the same columns
I have two columns, confid1 and confid2 . They both have the same data
I have two tables named, config and config_exceptions. Both has same structure. Columns are
I have two classes generated by LINQ2SQL both from the same table so they
I have two tables and they highlight as expected, but I only want 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.