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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:42:35+00:00 2026-05-17T01:42:35+00:00

I have two tables: A (col1,col2,col3,col4) B (col1,col2,col3,col4) Table A has 4 records(rows) and

  • 0

I have two tables:
A(col1,col2,col3,col4)

B(col1,col2,col3,col4)

Table A has 4 records(rows) and B has 6 rows.I want to join them like this,for example join them in C table

C(B.col1,B.col2,A.col3,A.col4,B.col3,B.col4) (tables have different values in records just col1 and col2 contains the same values)

when i join them on A.col1=B.col1 and A.col2=B.col2 I take Cartesian product 🙁

P.S I want to have 6 rows in C,where B.col1,B.col2,B.col3,B.col4 have 6rows and A.col3,A.col4 have 4 rows and other 2 null

please help me..

  • 1 1 Answer
  • 3 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-17T01:42:36+00:00Added an answer on May 17, 2026 at 1:42 am

    You need to use a FULL OUTER JOIN

    Select a.Col1,
           a.Col2,
           a.Col3,
           a.Col4,
           b.Col3,
           b.Col4
    
    From TableA a
    Full Outer Join TableB b on a.Col1 = b.Col1
                             And a.Col2 = b.Col2
    

    EDIT:

    “doesn’t work” is not going to help anyone. Maybe you could provide further details as to why it isn’t working for you.

    You could add some example data and the actual expected output to your question.

    e.g

    Create Table #TableA
    (
    Col1 
    ...
    )
    
    Insert Into #TableA
    Values (...)
    

    The clearer your question then the better the answers will be. If people don’t fully understand what your exact problem is and expected output you want then how are we supposed to provide you with a full and correct answer.

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

Sidebar

Related Questions

I have two identical tables such as : table1 col1 col2 col3 col4 col5
I have a table that looks like this: id, col1, col2 col3 0 Goat
I have two tables as below: Student: oneID (primary key), col1, col2, col3, subId,
I have two tables (Table A and Table B) which I want to join
I have two tables which I am left joining together. SELECT Col3, tab1.Col1, tab1.Col2
MY base table have two colums assume col1,col2. col1 have id, col2 have many
I have two MySQL tables with a similar structure. i.e. Table_A - Col1, Col2,
So I have two tables. Table1 have two columns, col1 and col2, where col1
So I have a table with three columns - col1 , col2 and col3
i have two mysql tables tableA col1 col2 SIM1 ..........col24 ----------------------------------- a x 1

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.