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

  • Home
  • SEARCH
  • 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 8307849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:37:49+00:00 2026-06-08T18:37:49+00:00

I´m working with mysql 5.5 and I have 2 tables, below +——–+—————+—————+ | CALLID

  • 0

I´m working with mysql 5.5 and
I have 2 tables, below

+--------+---------------+---------------+
| CALLID | DL_THROUGHPUT | UL_THROUGHPUT |
+--------+---------------+---------------+
|    115 |       33.3333 |       43.3333 |
|    116 |            70 |            80 |
+--------+---------------+---------------+

+--------+----------------+----------------+
| CALLID | DL_DATA_VOLUME | UL_DATA_VOLUME |
+--------+----------------+----------------+
|    117 |             45 |             35 |
+--------+----------------+----------------+

with full join I get this:

+--------+---------------+---------------+--------+----------------+----------------+
| CALLID | DL_THROUGHPUT | UL_THROUGHPUT | CALLID | DL_DATA_VOLUME | UL_DATA_VOLUME |
+--------+---------------+---------------+--------+----------------+----------------+
|    115 |       33.3333 |       43.3333 |   NULL |           NULL |           NULL |
|    116 |            70 |            80 |   NULL |           NULL |           NULL |
|   NULL |          NULL |          NULL |    117 |             45 |             35 |
+--------+---------------+---------------+--------+----------------+---------------+

and I need this:

 +--------+---------------+--------------+-----------------+----------------+
| CALLID | DL_THROUGHPUT | UL_THROUGHPUT |  DL_DATA_VOLUME | UL_DATA_VOLUME |
+--------+---------------+---------------+-----------------+----------------+
|    115 |       33.3333 |       43.3333 |            NULL |           NULL |
|    116 |            70 |            80 |            NULL |           NULL |
|    117 |          NULL |          NULL |              45 |             35 |
+--------+---------------+---------------+-----------------+---------------+

Any suggestions?

Thanks you very much
Thanks you Zane, sorry but before I don´t explain well also I can to have case as:

+--------+---------------+---------------+
| CALLID | DL_THROUGHPUT | UL_THROUGHPUT |
+--------+---------------+---------------+
|    115 |       33.3333 |       43.3333 |
|    116 |            70 |            80 |
|    117 |            48 |            51 |
+--------+---------------+---------------+

+--------+----------------+----------------+
| CALLID | DL_DATA_VOLUME | UL_DATA_VOLUME |
+--------+----------------+----------------+
|    117 |             45 |             35 |
|    118 |             37 |             26 |
+--------+----------------+----------------+

and I will need:

 +--------+---------------+--------------+-----------------+----------------+
| CALLID | DL_THROUGHPUT | UL_THROUGHPUT |  DL_DATA_VOLUME | UL_DATA_VOLUME |
+--------+---------------+---------------+-----------------+----------------+
|    115 |       33.3333 |       43.3333 |            NULL |           NULL |
|    116 |            70 |            80 |            NULL |           NULL |
|    117 |            48 |            51 |              45 |             35 |
|    118 |          NULL |          NULL |              37 |             26 |        
+--------+---------------+---------------+-----------------+---------------+
  • 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-08T18:37:50+00:00Added an answer on June 8, 2026 at 6:37 pm

    You can manually insert NULL values where you know they would be not applicable in the final result:

    SELECT CALLID, 
           DL_THROUGHPUT, 
           UL_THROUGHPUT, 
           NULL AS DL_DATA_VOLUME,
           NULL AS UL_DATA_VOLUME
    FROM   tbl_1
    
    UNION ALL
    
    SELECT CALLID, 
           NULL, 
           NULL, 
           DL_DATA_VOLUME, 
           UL_DATA_VOLUME
    FROM   tbl_2
    

    Update:

    You can use:

    SELECT    a.CALLID,
              b.DL_THROUGHPUT, 
              b.UL_THROUGHPUT, 
              c.DL_DATA_VOLUME, 
              c.UL_DATA_VOLUME
    FROM      (
              SELECT CALLID FROM tbl_1 UNION SELECT CALLID FROM tbl_2
              ) a
    LEFT JOIN tbl_1 b ON a.CALLID = b.CALLID
    LEFT JOIN tbl_2 c ON a.CALLID = c.CALLID
    ORDER BY  a.CALLID
    

    SQLFiddle Demo

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

Sidebar

Related Questions

I am working on PHP and database MySQL. I have two tables in SQL
I have working website in PHP with a MySQL backend which has several tables
I am working with MySQL version 5. I have two tables structured as shown
I have the below query where I join two tables, the query is working
Any idea why the following code is not working mysql credentials are correct, have
I'm working on building a tree structure in MySQL and have been experimenting with
I am working on a filter functionality using ajax/jquery and php/mysql.I have two sets
I have been working on on an AJAX chat application using php, mysql. It's
I have a java program that connects to a MySql database and it's working
My team working on a php/MySQL website for a school project. I have a

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.