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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:20:43+00:00 2026-06-04T13:20:43+00:00

I am trying to execute the below query. I am getting the same column,

  • 0

I am trying to execute the below query.

I am getting the same column, but for two consecutive days. The value I am inserting is day2.Value – day1.Value.

When tab2 does not contain a value (day2), the value to be inserted should just be 0 – day1.Value

The part not working is this -day1.Value when I have data for tab1 but not tab2. Instead I just get a null?

UPDATE tab2
SET Change = ISNULL(tab2.Value ,0) - ISNULL(tab1.Value ,0)
FROM Table_Name tab1
LEFT OUTER JOIN Table_Name  tab2 
    ON tab2.COBDate = '2012-5-18' 
    AND tab1.FileName = tab2.FileName 
    AND tab1.ID = tab2.ID  
    AND tab1.ScenarioID = tab2.ScenarioID
WHERE tab1.COBDate = '2012-5-17' 
    AND tab1.FileName = 'GBP.csv'
  • 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-04T13:20:45+00:00Added an answer on June 4, 2026 at 1:20 pm

    Try using COALESCE()?

    UPDATE tab2
    SET Change = COALESCE(tab2.Value ,0) - COALESCE(tab1.Value ,0)
    FROM Table_Name tab1
    LEFT OUTER JOIN 
    Table_Name  tab2 
    ON tab2.COBDate = '2012-5-18' AND 
    tab1.FileName = tab2.FileName AND 
    tab1.ID = tab2.ID  AND 
    tab1.ScenarioID = tab2.ScenarioID
    WHERE tab1.COBDate = '2012-5-17' AND tab1.FileName = 'GBP.csv'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute the following query but I receive a runtime error stating
While trying to execute the below query Declare @t table (id int, string varchar(1000))
I am trying to execute mysql select insert query as below. INSERT INTO ACCOUNTS.TABLE1
I am trying to get the sql query below to work but I am
I'm trying to execute an E4X query (on the xml below) that will return
I am trying to execute a MongoDB query as below : $Collection1->update({_id:\$id}, { \$set:
When i am trying to execute select query not executing . after the below
I have a problem when trying to execute this update statement (below) using C#
Below you could see template of SQL script that i'm trying to execute on
While trying to execute the following lines only the last two statements are displayed(Here

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.