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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:32:01+00:00 2026-05-25T22:32:01+00:00

Possible silly question, but got me stumped. Compare 2 tables and return only distinct

  • 0

Possible silly question, but got me stumped. Compare 2 tables and return only distinct columns.

        SELECT DISTINCT(DM.CLIENT_CODE) FROM DBO.DM_CLIENT DM
        LEFT JOIN DBO.STG_DM_CLIENT STG
        ON STG.CLIENT_CODE = DM.CLIENT_CODE

Aim of query is to return only new client_codes from DM table (or client_codes not listed in STG table).

I tought this would work, however does not.

can this query be then used in a case query to validate when new codes exists, then set resultset to ‘A’

       select  case 
            when (SELECT DBO.DM_CLIENT.Client_Code  
            FROM DBO.DM_CLIENT DM  
            LEFT JOIN DBO.STG_DM_CLIENT STG    
          ON STG.Client_Code= DM.Client_Code  
            WHERE STG.Client_Code IS NULL  
          GROUP BY  DM.Client_Code) then 'A'
       end

       from  DBO.DM_CLIENT.Client_Code, DBO.STG_DM_CLIENT.Client_Code

How can I make that statement to be a conditional statement?

  • 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-05-25T22:32:01+00:00Added an answer on May 25, 2026 at 10:32 pm

    Sounds like you want to return those from DM that don’t exist in STG.

     SELECT DM.Client_Code
     FROM DBO.DM_CLIENT As DM
     LEFT JOIN DBO.STG_DM_CLIENT As STG 
       ON STG.Client_Code= DM.Client_Code
     WHERE STG.Client_Code IS NULL
     GROUP BY  DM.Client_Code;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It this possible? How? (Maybe silly question, but I couldn't find answer :( )
This is kind of a silly question, but is it possible to get the
This might be a silly question, but, given the output of, say.. >>> from
Possibly a silly question, but how do I prevent a select element in a
Possibly a silly question, but I'm having no luck finding an answer. Using Visual
This may be a silly question but... Say you have a sentence like: The
This is an admittedly silly question, but I honestly don't know if this is
This is, perhaps, a silly question, but it's something that I've wondered about: is
I'm new to iPhone development, so apologies if this is a silly question, but
Sorry if this is a silly and/or stupid question but... Will there ever be,

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.