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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:58:15+00:00 2026-05-29T09:58:15+00:00

I retrieve data form 3 tables (date and qty), some data may overlap but

  • 0

I retrieve data form 3 tables (date and qty), some data may overlap but is not sure which tables. For example some days may overlap in
tables t1 and t2 but not in t3,
or t2 and t3 but not in t1
or t1 and t3 but not in t2

If I perform a full join I end up with lots of nulls and three different date columns.

How can I get data to format:
date,qty1, qty2, gty3 where [date] would contain all days form 3 tables?
Zero would replace all null values

07/02/2012  ||   2   ||  0  ||  7 


CREATE TABLE t1 (
    [date] [nvarchar](10) 
    ,qtyt1 [int]
) 

CREATE TABLE t2 (
    [date] [nvarchar](10) 
    ,qtyt2 [int]
) 

CREATE TABLE t3 (
    [date] [nvarchar](10) 
    ,qtyt3 [int]
) 


insert into t1 values ('05/02/2012', 2)
insert into t1 values ('07/02/2012', 3)
insert into t2 values ('06/02/2012', 4)
insert into t2 values ('08/02/2012', 5)
insert into t3 values ('07/02/2012', 7)
insert into t3 values ('08/02/2012', 11)


select * from t1
full join t2 on t1.date = t2.date 
full join t3 on t2.date = t3.date
  • 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-29T09:58:16+00:00Added an answer on May 29, 2026 at 9:58 am
    SELECT COALESCE(t1.date, t2.date, t3.date) AS date,
           qtyt1,
           qtyt2,
           qtyt3
    FROM   t1
           FULL JOIN t2
             ON t1.date = t2.date
           FULL JOIN t3
             ON ISNULL(t2.date, t1.date) = t3.date  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam trying to retrieve data from mysql database into stylesheet.php but it is not
trying to retrieve some data from the database and put in into my form.
How to retrieve data from two tables whose column names are the same?
I need to retrieve data from two tables. the first is a list of
Is it possible to retrieve data from multiple tables in a LINQ-to-sql database to
In my jsp code I use the request.getParameter() to retrieve the data which is
I'm trying to make update form, that is going to retrieve the data for
I am trying to build a web service in .NET, which will retrieve data
I am trying to retrieve data form a dataset by using code below :
Generally I connect and retrieve data using the standard way (error checking removed for

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.