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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:07:39+00:00 2026-05-17T18:07:39+00:00

Possible Duplicate: How to join two tables table 1 Date StartingAum 07/01/2010 120 08/01/2010

  • 0

Possible Duplicate:
How to join two tables

table 1

Date         StartingAum

07/01/2010     120
08/01/2010     220
09/01/2010     320

table 2

Date          DepContr   withdra    
01/01/2010      60          15
02/01/2010      70          25
03/01/2010      80          15
04/01/2010      30          89 
05/01/2010      40          15
06/01/2010      25          85
07/01/2010      16          17   
08/01/2010      19          21
09/01/2010      68          79

the output should be

Date         StartingAum     DepContr   withdra    
01/01/2010      0              60          15
02/01/2010      0              70          25
03/01/2010      0              80          15
04/01/2010      0              30          89 
05/01/2010      0              40          15
06/01/2010      0              25          85
07/01/2010     120             16          17   
08/01/2010     220             19          21
09/01/2010     320             68          79

i need the output exactly similar to that

  • 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-17T18:07:40+00:00Added an answer on May 17, 2026 at 6:07 pm
    DECLARE @Table1 table ([date] datetime, StartingAum int)
    DECLARE @Table2 table ([date] datetime, DepContr int, withdra int)
    INSERT @Table1 VALUES ('07/01/2010',     120)
    INSERT @Table1 VALUES ('08/01/2010',     220)
    INSERT @Table1 VALUES ('09/01/2010',     320)
    
    INSERT @Table2 VALUES ('01/01/2010',      60 ,         15)
    INSERT @Table2 VALUES ('02/01/2010',      70 ,         25)
    INSERT @Table2 VALUES ('03/01/2010',      80 ,         15)
    INSERT @Table2 VALUES ('04/01/2010',      30 ,         89)
    INSERT @Table2 VALUES ('05/01/2010',      40 ,         15)
    INSERT @Table2 VALUES ('06/01/2010',      25 ,         85)
    INSERT @Table2 VALUES ('07/01/2010',      16 ,         17)
    INSERT @Table2 VALUES ('08/01/2010',      19 ,         21)
    INSERT @Table2 VALUES ('09/01/2010',      68 ,         79)
    
    
    SELECT 
        t2.[Date]
            ,ISNULL(t1.StartingAum, 0) AS StartingAum     
            ,t2.DepContr
            ,t2.withdra   
        FROM @Table2           t2
            LEFT JOIN @Table1  t1 ON t2.[Date] = t1.[Date]
        ORDER BY t2.[Date]
    

    OUTPUT:

    Date                    StartingAum DepContr    withdra
    ----------------------- ----------- ----------- -----------
    2010-01-01 00:00:00.000 0           60          15
    2010-02-01 00:00:00.000 0           70          25
    2010-03-01 00:00:00.000 0           80          15
    2010-04-01 00:00:00.000 0           30          89
    2010-05-01 00:00:00.000 0           40          15
    2010-06-01 00:00:00.000 0           25          85
    2010-07-01 00:00:00.000 120         16          17
    2010-08-01 00:00:00.000 220         19          21
    2010-09-01 00:00:00.000 320         68          79
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How do I join two lines in vi? I have the following
Possible Duplicate: SQL - how to SELECT multiple tables and JOIN multiple rows from
Possible Duplicate: Mysql single query join 3 table and get all the results Hi
Possible Duplicate: SQL left join vs multiple tables on FROM line? SELECT messages.message_title, messages.message_content,
Possible Duplicate: Ruby on Rails: How can i join with a derived table? posts
Possible Duplicate: Combining several database table together? I want from two database table get
Possible Duplicate: Three table join with joins other than INNER JOIN I'm a beginner
Possible Duplicate: How to update two tables in one statement in SQL Server 2005?
Possible Duplicate: What's the difference between NOT EXISTS vs. NOT IN vs. LEFT JOIN
Possible Duplicate: How to minify php page html output? Any reason not to strip

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.