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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:54:23+00:00 2026-06-07T17:54:23+00:00

Join both the tables and get first table data and second table data which

  • 0

Join both the tables and get first table data and second table data which is missing in Table1 by comparing on Col1 and Col11 I guess. As all the ID’s (Col1 and Col11) should come together

Table1

Col1      Col2            Col3                  Col4      Col5            Col6 
1345653   330760137950    2012-07-09 21:40:29   1345653   331760137950    1341895229
1345653   110909316904    2012-07-09 21:29:06   1345653   111909316904    1341894546
1345653   221065796761    2012-07-09 19:31:48   1345653   221065796761    1341887518

Table2

Col11        Col22         Col33                  
1345653      330760137950   2012-07-09 21:40:29     
1345653      110909316904   2012-07-09 21:29:06     
1345653      221065796761   2012-07-09 19:31:48     
1345653    **150851771618**   2012-07-09 18:57:33 

If you look above two tables data, last line in Table2 means Col22-150851771618 is missing in Table1. So I need to display Table1 full data and last line from Table2 as Col22 is missing in Table1 by joining on Col1 and Col11, like this below output.

1345653   330760137950    2012-07-09 21:40:29   1345653   331760137950    1341895229
1345653   110909316904    2012-07-09 21:29:06   1345653   111909316904    1341894546
1345653   221065796761    2012-07-09 19:31:48   1345653   221065796761    1341887518
1345653 **150851771618**  2012-07-09 18:57:33   NULL       NULL           NULL

How can I do this using JOIN by joining on Col1 and Col11? I am having lot of confusion on this. Can anyone help me?

Update:- Some more scenarios

Table1

Col1            Col2            Col3                   Col4       Col5                Col6
1345653     330760137950    2012-07-09 21:40:29     1345653     331760137950        1341895229
1345653     110909316904    2012-07-09 21:29:06     1345653     111909316904        1341894546
1345653     221065796761    2012-07-09 19:31:48     1345653     221065796761        1341887518

704318001   320941581940    2012-07-09 14:44:48     704318001   321941581940        1341870288 

Table2

Col11        Col22         Col33                   Col44   Col55   Col66
1345653      330760137950   2012-07-09 21:40:29     NULL    NULL    NULL
1345653      110909316904   2012-07-09 21:29:06     NULL    NULL    NULL
1345653      221065796761   2012-07-09 19:31:48     NULL    NULL    NULL
1345653    **150851771618**   2012-07-09 18:57:33   NULL    NULL    NULL

704318001  **290738585064**    2012-07-09 14:36:49     NULL    NULL    NULL

So Output should be like this- Meaning for this 1345653 ID, I need all record at same place and same with 704318001. So if you look the output, all the 1345653 are together and all 704318001 are together.

1345653   330760137950    2012-07-09 21:40:29   1345653   331760137950    1341895229
1345653   110909316904    2012-07-09 21:29:06   1345653   111909316904    1341894546
1345653   221065796761    2012-07-09 19:31:48   1345653   221065796761    1341887518
1345653 **150851771618**  2012-07-09 18:57:33   NULL       NULL           NULL


704318001   320941581940    2012-07-09 14:44:48     704318001   321941581940        1341870288 
704318001  **290738585064**    2012-07-09 14:36:49     NULL    NULL    NULL

Basically, get the first table full and second table whose data is not there in Table1

  • 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-07T17:54:24+00:00Added an answer on June 7, 2026 at 5:54 pm

    A LEFT JOIN should work..

    But based on your data, I think you should be joining on Col22 to Col2, since Col1 and Col11 don’t have unique values, so I don’t know how they are associated.

    SELECT t2.Col11, t2.Col22, t2.Col33, t1.Col4, t1.Col5, t1.Col6
    FROM 
        Table2 t2 LEFT JOIN
        Table1 t1 ON t1.Col2 = t2.Col22
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first attempt at a JOIN MySQL statement... I have 2 tables..
I have two tables and a join table. I tried using the $hasAndBelongsToMany but
I have a database with 2 tables I wish to pull data from both
The question is to get table column data and use it as a value
I'm using two tables in the database. The first contains data related to the
I can't get both INNER JOINS working. Data is being displayed when I only
I have two tables - incoming tours(id,name) and incoming_tours_cities(id_parrent, id_city) id in first table
I have 2 tables with tth hashes, and i need to get which of
I'm trying to join two associative arrays together based on an entry_id key. Both
Which Join having more I/O and CPU Cycle ? Hash join or Merge join

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.