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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:57:44+00:00 2026-06-01T19:57:44+00:00

I am novice to sql I have a table1 with [month], [forecasted avg. temperature]

  • 0

I am novice to sql

I have a table1 with [month], [forecasted avg. temperature] as columns. I have another table2 with [month], [actual avg. temperature] as columns. Now for some dates, there is no records available in table one. In that case I would like to pull records from the table2 if I have available record in that table.

for example table 1 may have records from april to dec for a year say 2010. table 2 has the records for jan to dec for 2010 year. I would like to pull records from table 2 for the mising jan, feb, mar months records in table 1.

Any idea. we are using sql server 2008

Thanks in advance.

  • 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-01T19:57:47+00:00Added an answer on June 1, 2026 at 7:57 pm
    select 
       [month], isnull([forecasted avg. temperature], [actual avg. temperature]) as temperature 
    from 
       table2 left outer join table1 on table1.[month] = table2.[month]
    

    UPDATE
    per comment from Dems, I changed the query. The original post makes it sound as though table2 includes data for all months, so rather than a FULL JOIN, I just switched so it will pull all records from table2, and join if available to table1, continuing to use ISNULL for the temp. If table2 does not include all data, then a FULL JOIN is necessary.

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

Sidebar

Related Questions

Could you please list some of the bad practices in SQL, that novice people
database/SQL novice here. I have a table with a column called, for example, EmployeeID.
I have an oracle sql query select distinct tab1.col1, tab2.col1 from table1 tab1 join
I don't consider myself a complete SQL novice, but I have been staring at
Notice: You have an error in your SQL syntax; check the manual that corresponds
I am a SQL novice. My problem is I can't find the infinite loop
I'm a novice when it comes to SQL and PHP, and I'm trying to
I'm a novice when it comes to sql so forgive me if this seems
Python novice here. I am using python2.7.2 on Windows7. I have installed the PyWin32
Hope someone can help - I am a novice SQL hacker (and very bad

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.