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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:04:20+00:00 2026-05-26T22:04:20+00:00

I have two tables t1(id,c) values = (1,aa),(2,bb),(3,cc) t2(id,c) values = (2,bbb),(3,ccc),(4,ddd) I need

  • 0

I have two tables

t1(id,c)
values = (1,aa),(2,bb),(3,cc)

t2(id,c)
values = (2,bbb),(3,ccc),(4,ddd)

I need a query that will produce:

1,aa,null,null
2,bb,2,bbb
3,cc,3,ccc
null,null,4,ddd

Can this be done in MySql?

  • 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-26T22:04:20+00:00Added an answer on May 26, 2026 at 10:04 pm
    select t1.id,t1.c, t2.id, t2.c
    FROM t1
    LEFT JOIN t2 on t1.id=t2.id
    UNION
    select t1.id,t1.c, t2.id, t2.c
    FROM t2
    LEFT JOIN t1 on t1.id=t2.id
    

    based on albin’s response.

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

Sidebar

Related Questions

I have two tables that need the exact same values for denormalization purposes. Here's
So I have two tables in this simplified example: People and Houses. People can
I have two tables that need to be joined based on matching xml. The
I have two or more tables which hold values under the same column name.
I have two tables with a weak relation. I need get a text value
I have two columns in a table that are populated with integer values. For
I have used a join query for retrieving value from two tables one is
I have two tables which both contain 'pipe separated values' e.g: Table 1: DataField_A
I have two tables, one for values one for location and am trying to
I have two tables, and I'm trying to look up values from one to

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.