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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:38:42+00:00 2026-06-12T06:38:42+00:00

I have two tables named, config and config_exceptions. Both has same structure. Columns are

  • 0

I have two tables named, config and config_exceptions. Both has same structure. Columns are home, configName, data, active.

config table has below data

0 config1 my_data1 active
0 config1 my_data2 active
0 config1 my_data3 active
0 config2 my_data3 active
2 config1 my_data1 active
2 config2 my_data1 active

config_exceptions table has below data

10 config1 my_data1 active

I need to write a query to exempt config_exceptions data with home 0 alone to give results, like below

0 config1 my_data1 active
0 config1 my_data2 active
0 config1 my_data3 active
0 config2 my_data3 active
2 config1 my_data1 active
2 config2 my_data1 active
10 config1 my_data2 active
10 config1 my_data3 active

This result is creating a new set of config results for home 10 using home 0 and exclude the config_exceptions table data. main columns for comparing is home and configName.

And I can’t hard code as 10, they will be more, but 0 can be hard coded as it is used as base.

Please help me to write this query, I don’t have idea. Please give me some idea.

  • 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-12T06:38:43+00:00Added an answer on June 12, 2026 at 6:38 am

    Well, with your sample, this does work.

    SELECT home, configName, data, active
    FROM config
    
    UNION
    
    SELECT ce.home, c.configName, c.data, c.active
    FROM config_exceptions ce
    INNER JOIN config c ON c.configName = ce.configName
    WHERE ce.data <> c.data
    AND c.home = 0
    

    SqlFiddle

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

Sidebar

Related Questions

I have two tables named foo and bar , hypothetically speaking. foo has columns
I have two tables, both named as say, Employee in two different schema HR
I have two tables, named t_master and t_detail. The data in the t_detail table
I have two tables, both named Language in two different schemas, lets call them
I have two tables, with a same column named user_name , saying table_a ,
I have two tables one named Person , which contains columns ID and Name
I have two tables named tbl_collectiondesireddatetimelocations and tbl_locations Structure of tbl_collectiondesireddatetimelocations is : pk_collectiondesireddatetimelocationid
I have two tables table1 and table2 each having a column named email along
So I have two tables. Table 1 is named 'appointment' with the following fields:
I have combined two different tables together, one side is named DynDom and 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.