Compare all columns from two tables and get the matched and unmatched data? [closed]











up vote
-3
down vote

favorite
1












I have two table with different column name and most of the values are same . I want the matched and unmatched data from the other table.



***
src-table
--------------------------------------------------------------------------------
eid | ename | email | country
--------------------------------------------------------------------------------
1 as as@gmail.com india
2 bs bs@gmail.com usa
3 cs cs@gmail.com usa
4 ds ds@gmail.com india
--------------------------------------------------------------------------------
tgt_table
--------------------------------------------------------------------------------
eid | ename | email | country
--------------------------------------------------------------------------------
1 as as@gmail.com india
2 bs b@gmail.com india
3 cs cs@gmail.com usa
4 ds d@gmail.com india
--------------------------------------------------------------------------------
expected output for matched_data
--------------------------------------------------------------------------------
src_coloumnname | src_data | tgt_colomnname | tgt_data
--------------------------------------------------------------------------------
eid 1 eid 1
eid 2 eid 2
eid 3 eid 3
eid 4 eid 4
ename as ename as
ename bs ename bs
ename cs ename cs
ename ds ename ds
email as@gmail.com email as@gmail.com
email cs@gmail.com email cs@gmail.com
country india country india
country usa country usa
country india country india
----------------------------------------------------------------------------
***



  • similarly unmatched records
    how can i achieve that? can some one plz help me?










share|improve this question















closed as unclear what you're asking by Madhur Bhaiya, P.Salmon, Giorgos Myrianthous, slavoo, Josh Lee Nov 13 at 0:28


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • 'I have two table with different column name ' - they look the same to me?
    – P.Salmon
    Nov 12 at 9:10










  • It looks like you are trying to compare columns in a non relational way. Why do you want to do this?
    – Tim Biegeleisen
    Nov 12 at 9:11










  • Can you please edit your question and add the SQL you already have and show us where/how it fails?
    – Corion
    Nov 12 at 9:11






  • 1




    What are the fields that will link both tables and will always match? Only eid? What are the fields that can differ?
    – Antonio Alvarez
    Nov 12 at 9:11










  • i need query for expected output? if you know plz share
    – dumbuu
    Nov 12 at 9:20















up vote
-3
down vote

favorite
1












I have two table with different column name and most of the values are same . I want the matched and unmatched data from the other table.



***
src-table
--------------------------------------------------------------------------------
eid | ename | email | country
--------------------------------------------------------------------------------
1 as as@gmail.com india
2 bs bs@gmail.com usa
3 cs cs@gmail.com usa
4 ds ds@gmail.com india
--------------------------------------------------------------------------------
tgt_table
--------------------------------------------------------------------------------
eid | ename | email | country
--------------------------------------------------------------------------------
1 as as@gmail.com india
2 bs b@gmail.com india
3 cs cs@gmail.com usa
4 ds d@gmail.com india
--------------------------------------------------------------------------------
expected output for matched_data
--------------------------------------------------------------------------------
src_coloumnname | src_data | tgt_colomnname | tgt_data
--------------------------------------------------------------------------------
eid 1 eid 1
eid 2 eid 2
eid 3 eid 3
eid 4 eid 4
ename as ename as
ename bs ename bs
ename cs ename cs
ename ds ename ds
email as@gmail.com email as@gmail.com
email cs@gmail.com email cs@gmail.com
country india country india
country usa country usa
country india country india
----------------------------------------------------------------------------
***



  • similarly unmatched records
    how can i achieve that? can some one plz help me?










share|improve this question















closed as unclear what you're asking by Madhur Bhaiya, P.Salmon, Giorgos Myrianthous, slavoo, Josh Lee Nov 13 at 0:28


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • 'I have two table with different column name ' - they look the same to me?
    – P.Salmon
    Nov 12 at 9:10










  • It looks like you are trying to compare columns in a non relational way. Why do you want to do this?
    – Tim Biegeleisen
    Nov 12 at 9:11










  • Can you please edit your question and add the SQL you already have and show us where/how it fails?
    – Corion
    Nov 12 at 9:11






  • 1




    What are the fields that will link both tables and will always match? Only eid? What are the fields that can differ?
    – Antonio Alvarez
    Nov 12 at 9:11










  • i need query for expected output? if you know plz share
    – dumbuu
    Nov 12 at 9:20













up vote
-3
down vote

favorite
1









up vote
-3
down vote

favorite
1






1





I have two table with different column name and most of the values are same . I want the matched and unmatched data from the other table.



***
src-table
--------------------------------------------------------------------------------
eid | ename | email | country
--------------------------------------------------------------------------------
1 as as@gmail.com india
2 bs bs@gmail.com usa
3 cs cs@gmail.com usa
4 ds ds@gmail.com india
--------------------------------------------------------------------------------
tgt_table
--------------------------------------------------------------------------------
eid | ename | email | country
--------------------------------------------------------------------------------
1 as as@gmail.com india
2 bs b@gmail.com india
3 cs cs@gmail.com usa
4 ds d@gmail.com india
--------------------------------------------------------------------------------
expected output for matched_data
--------------------------------------------------------------------------------
src_coloumnname | src_data | tgt_colomnname | tgt_data
--------------------------------------------------------------------------------
eid 1 eid 1
eid 2 eid 2
eid 3 eid 3
eid 4 eid 4
ename as ename as
ename bs ename bs
ename cs ename cs
ename ds ename ds
email as@gmail.com email as@gmail.com
email cs@gmail.com email cs@gmail.com
country india country india
country usa country usa
country india country india
----------------------------------------------------------------------------
***



  • similarly unmatched records
    how can i achieve that? can some one plz help me?










share|improve this question















I have two table with different column name and most of the values are same . I want the matched and unmatched data from the other table.



***
src-table
--------------------------------------------------------------------------------
eid | ename | email | country
--------------------------------------------------------------------------------
1 as as@gmail.com india
2 bs bs@gmail.com usa
3 cs cs@gmail.com usa
4 ds ds@gmail.com india
--------------------------------------------------------------------------------
tgt_table
--------------------------------------------------------------------------------
eid | ename | email | country
--------------------------------------------------------------------------------
1 as as@gmail.com india
2 bs b@gmail.com india
3 cs cs@gmail.com usa
4 ds d@gmail.com india
--------------------------------------------------------------------------------
expected output for matched_data
--------------------------------------------------------------------------------
src_coloumnname | src_data | tgt_colomnname | tgt_data
--------------------------------------------------------------------------------
eid 1 eid 1
eid 2 eid 2
eid 3 eid 3
eid 4 eid 4
ename as ename as
ename bs ename bs
ename cs ename cs
ename ds ename ds
email as@gmail.com email as@gmail.com
email cs@gmail.com email cs@gmail.com
country india country india
country usa country usa
country india country india
----------------------------------------------------------------------------
***



  • similarly unmatched records
    how can i achieve that? can some one plz help me?







mysql sql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 9:07









Madhur Bhaiya

19.2k62236




19.2k62236










asked Nov 12 at 9:04









dumbuu

64




64




closed as unclear what you're asking by Madhur Bhaiya, P.Salmon, Giorgos Myrianthous, slavoo, Josh Lee Nov 13 at 0:28


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Madhur Bhaiya, P.Salmon, Giorgos Myrianthous, slavoo, Josh Lee Nov 13 at 0:28


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 'I have two table with different column name ' - they look the same to me?
    – P.Salmon
    Nov 12 at 9:10










  • It looks like you are trying to compare columns in a non relational way. Why do you want to do this?
    – Tim Biegeleisen
    Nov 12 at 9:11










  • Can you please edit your question and add the SQL you already have and show us where/how it fails?
    – Corion
    Nov 12 at 9:11






  • 1




    What are the fields that will link both tables and will always match? Only eid? What are the fields that can differ?
    – Antonio Alvarez
    Nov 12 at 9:11










  • i need query for expected output? if you know plz share
    – dumbuu
    Nov 12 at 9:20


















  • 'I have two table with different column name ' - they look the same to me?
    – P.Salmon
    Nov 12 at 9:10










  • It looks like you are trying to compare columns in a non relational way. Why do you want to do this?
    – Tim Biegeleisen
    Nov 12 at 9:11










  • Can you please edit your question and add the SQL you already have and show us where/how it fails?
    – Corion
    Nov 12 at 9:11






  • 1




    What are the fields that will link both tables and will always match? Only eid? What are the fields that can differ?
    – Antonio Alvarez
    Nov 12 at 9:11










  • i need query for expected output? if you know plz share
    – dumbuu
    Nov 12 at 9:20
















'I have two table with different column name ' - they look the same to me?
– P.Salmon
Nov 12 at 9:10




'I have two table with different column name ' - they look the same to me?
– P.Salmon
Nov 12 at 9:10












It looks like you are trying to compare columns in a non relational way. Why do you want to do this?
– Tim Biegeleisen
Nov 12 at 9:11




It looks like you are trying to compare columns in a non relational way. Why do you want to do this?
– Tim Biegeleisen
Nov 12 at 9:11












Can you please edit your question and add the SQL you already have and show us where/how it fails?
– Corion
Nov 12 at 9:11




Can you please edit your question and add the SQL you already have and show us where/how it fails?
– Corion
Nov 12 at 9:11




1




1




What are the fields that will link both tables and will always match? Only eid? What are the fields that can differ?
– Antonio Alvarez
Nov 12 at 9:11




What are the fields that will link both tables and will always match? Only eid? What are the fields that can differ?
– Antonio Alvarez
Nov 12 at 9:11












i need query for expected output? if you know plz share
– dumbuu
Nov 12 at 9:20




i need query for expected output? if you know plz share
– dumbuu
Nov 12 at 9:20












2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










It could be done using one column at a time:



SELECT 'eid' AS match_column, l.eid AS src_value, r.eid AS tgt_value, CASE WHEN l.eid = r.eid THEN 'match' ELSE 'no match' END AS result
FROM table1 AS l
INNER JOIN table2 AS r ON l.eid = r.eid

UNION ALL

SELECT 'ename', l.ename, r.ename, CASE WHEN l.ename = r.ename THEN 'match' ELSE 'no match' END
FROM table1 AS l
INNER JOIN table2 AS r ON l.eid = r.eid

UNION ALL

SELECT 'email', l.email, r.email, CASE WHEN l.email = r.email THEN 'match' ELSE 'no match' END
FROM table1 AS l
INNER JOIN table2 AS r ON l.eid = r.eid

UNION ALL

SELECT 'country', l.country, r.country, CASE WHEN l.country = r.country THEN 'match' ELSE 'no match' END
FROM table1 AS l
INNER JOIN table2 AS r ON l.eid = r.eid


It matches columns where the rows match. It does not check rows that are missing from either table.






share|improve this answer























  • thanks bro.it helps me lot thank you
    – dumbuu
    Nov 12 at 9:38












  • sir, is it possible in generic way can you explain how is that possible? plz
    – dumbuu
    Nov 12 at 10:38










  • Like you don't want to hard code column names... sorry, I have no idea.
    – Salman A
    Nov 12 at 10:39










  • sir i want only matched data i don't want unmatched date how can i achieve that ? when i remove unmatch in query i get null in that place could you pllease help me?
    – dumbuu
    Nov 14 at 6:10










  • The CASE is there to "display" the result. If you want to limit results to matched rows only then remove all CASE and add the condition such as WHERE l.ename = r.ename to each query. If you want to consider NULL = NULL then use WHERE l.ename <=> r.ename instead.
    – Salman A
    Nov 14 at 6:15




















up vote
0
down vote













you can do a simple join, i think you can do this



SELECT * FROM T1 FULL OUTER JOIN T2 ON TRUE 


or
SELECT * FROM T1 , T2



for everyting



SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 <> T2.T1_C1
for the unmatched



SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 = T2.T1_C1
for matched



you can also change type of join for matching
here the join documentation
https://www.w3schools.com/sql/sql_join.asp
you can also



SELECT T1.C1, T2.C1,T1.C2, ..., CASE WHEN T1.C1=T2.T1_C1 THEN 'MATCH' ELSE 'NOT MATCH' END FROM T1,T2


for have you result with the evidence of matching
this is the documenation of case
https://www.w3schools.com/sql/sql_case.asp






share|improve this answer




























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    It could be done using one column at a time:



    SELECT 'eid' AS match_column, l.eid AS src_value, r.eid AS tgt_value, CASE WHEN l.eid = r.eid THEN 'match' ELSE 'no match' END AS result
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'ename', l.ename, r.ename, CASE WHEN l.ename = r.ename THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'email', l.email, r.email, CASE WHEN l.email = r.email THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'country', l.country, r.country, CASE WHEN l.country = r.country THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid


    It matches columns where the rows match. It does not check rows that are missing from either table.






    share|improve this answer























    • thanks bro.it helps me lot thank you
      – dumbuu
      Nov 12 at 9:38












    • sir, is it possible in generic way can you explain how is that possible? plz
      – dumbuu
      Nov 12 at 10:38










    • Like you don't want to hard code column names... sorry, I have no idea.
      – Salman A
      Nov 12 at 10:39










    • sir i want only matched data i don't want unmatched date how can i achieve that ? when i remove unmatch in query i get null in that place could you pllease help me?
      – dumbuu
      Nov 14 at 6:10










    • The CASE is there to "display" the result. If you want to limit results to matched rows only then remove all CASE and add the condition such as WHERE l.ename = r.ename to each query. If you want to consider NULL = NULL then use WHERE l.ename <=> r.ename instead.
      – Salman A
      Nov 14 at 6:15

















    up vote
    0
    down vote



    accepted










    It could be done using one column at a time:



    SELECT 'eid' AS match_column, l.eid AS src_value, r.eid AS tgt_value, CASE WHEN l.eid = r.eid THEN 'match' ELSE 'no match' END AS result
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'ename', l.ename, r.ename, CASE WHEN l.ename = r.ename THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'email', l.email, r.email, CASE WHEN l.email = r.email THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'country', l.country, r.country, CASE WHEN l.country = r.country THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid


    It matches columns where the rows match. It does not check rows that are missing from either table.






    share|improve this answer























    • thanks bro.it helps me lot thank you
      – dumbuu
      Nov 12 at 9:38












    • sir, is it possible in generic way can you explain how is that possible? plz
      – dumbuu
      Nov 12 at 10:38










    • Like you don't want to hard code column names... sorry, I have no idea.
      – Salman A
      Nov 12 at 10:39










    • sir i want only matched data i don't want unmatched date how can i achieve that ? when i remove unmatch in query i get null in that place could you pllease help me?
      – dumbuu
      Nov 14 at 6:10










    • The CASE is there to "display" the result. If you want to limit results to matched rows only then remove all CASE and add the condition such as WHERE l.ename = r.ename to each query. If you want to consider NULL = NULL then use WHERE l.ename <=> r.ename instead.
      – Salman A
      Nov 14 at 6:15















    up vote
    0
    down vote



    accepted







    up vote
    0
    down vote



    accepted






    It could be done using one column at a time:



    SELECT 'eid' AS match_column, l.eid AS src_value, r.eid AS tgt_value, CASE WHEN l.eid = r.eid THEN 'match' ELSE 'no match' END AS result
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'ename', l.ename, r.ename, CASE WHEN l.ename = r.ename THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'email', l.email, r.email, CASE WHEN l.email = r.email THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'country', l.country, r.country, CASE WHEN l.country = r.country THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid


    It matches columns where the rows match. It does not check rows that are missing from either table.






    share|improve this answer














    It could be done using one column at a time:



    SELECT 'eid' AS match_column, l.eid AS src_value, r.eid AS tgt_value, CASE WHEN l.eid = r.eid THEN 'match' ELSE 'no match' END AS result
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'ename', l.ename, r.ename, CASE WHEN l.ename = r.ename THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'email', l.email, r.email, CASE WHEN l.email = r.email THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid

    UNION ALL

    SELECT 'country', l.country, r.country, CASE WHEN l.country = r.country THEN 'match' ELSE 'no match' END
    FROM table1 AS l
    INNER JOIN table2 AS r ON l.eid = r.eid


    It matches columns where the rows match. It does not check rows that are missing from either table.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 12 at 9:43

























    answered Nov 12 at 9:18









    Salman A

    174k66334421




    174k66334421












    • thanks bro.it helps me lot thank you
      – dumbuu
      Nov 12 at 9:38












    • sir, is it possible in generic way can you explain how is that possible? plz
      – dumbuu
      Nov 12 at 10:38










    • Like you don't want to hard code column names... sorry, I have no idea.
      – Salman A
      Nov 12 at 10:39










    • sir i want only matched data i don't want unmatched date how can i achieve that ? when i remove unmatch in query i get null in that place could you pllease help me?
      – dumbuu
      Nov 14 at 6:10










    • The CASE is there to "display" the result. If you want to limit results to matched rows only then remove all CASE and add the condition such as WHERE l.ename = r.ename to each query. If you want to consider NULL = NULL then use WHERE l.ename <=> r.ename instead.
      – Salman A
      Nov 14 at 6:15




















    • thanks bro.it helps me lot thank you
      – dumbuu
      Nov 12 at 9:38












    • sir, is it possible in generic way can you explain how is that possible? plz
      – dumbuu
      Nov 12 at 10:38










    • Like you don't want to hard code column names... sorry, I have no idea.
      – Salman A
      Nov 12 at 10:39










    • sir i want only matched data i don't want unmatched date how can i achieve that ? when i remove unmatch in query i get null in that place could you pllease help me?
      – dumbuu
      Nov 14 at 6:10










    • The CASE is there to "display" the result. If you want to limit results to matched rows only then remove all CASE and add the condition such as WHERE l.ename = r.ename to each query. If you want to consider NULL = NULL then use WHERE l.ename <=> r.ename instead.
      – Salman A
      Nov 14 at 6:15


















    thanks bro.it helps me lot thank you
    – dumbuu
    Nov 12 at 9:38






    thanks bro.it helps me lot thank you
    – dumbuu
    Nov 12 at 9:38














    sir, is it possible in generic way can you explain how is that possible? plz
    – dumbuu
    Nov 12 at 10:38




    sir, is it possible in generic way can you explain how is that possible? plz
    – dumbuu
    Nov 12 at 10:38












    Like you don't want to hard code column names... sorry, I have no idea.
    – Salman A
    Nov 12 at 10:39




    Like you don't want to hard code column names... sorry, I have no idea.
    – Salman A
    Nov 12 at 10:39












    sir i want only matched data i don't want unmatched date how can i achieve that ? when i remove unmatch in query i get null in that place could you pllease help me?
    – dumbuu
    Nov 14 at 6:10




    sir i want only matched data i don't want unmatched date how can i achieve that ? when i remove unmatch in query i get null in that place could you pllease help me?
    – dumbuu
    Nov 14 at 6:10












    The CASE is there to "display" the result. If you want to limit results to matched rows only then remove all CASE and add the condition such as WHERE l.ename = r.ename to each query. If you want to consider NULL = NULL then use WHERE l.ename <=> r.ename instead.
    – Salman A
    Nov 14 at 6:15






    The CASE is there to "display" the result. If you want to limit results to matched rows only then remove all CASE and add the condition such as WHERE l.ename = r.ename to each query. If you want to consider NULL = NULL then use WHERE l.ename <=> r.ename instead.
    – Salman A
    Nov 14 at 6:15














    up vote
    0
    down vote













    you can do a simple join, i think you can do this



    SELECT * FROM T1 FULL OUTER JOIN T2 ON TRUE 


    or
    SELECT * FROM T1 , T2



    for everyting



    SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 <> T2.T1_C1
    for the unmatched



    SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 = T2.T1_C1
    for matched



    you can also change type of join for matching
    here the join documentation
    https://www.w3schools.com/sql/sql_join.asp
    you can also



    SELECT T1.C1, T2.C1,T1.C2, ..., CASE WHEN T1.C1=T2.T1_C1 THEN 'MATCH' ELSE 'NOT MATCH' END FROM T1,T2


    for have you result with the evidence of matching
    this is the documenation of case
    https://www.w3schools.com/sql/sql_case.asp






    share|improve this answer

























      up vote
      0
      down vote













      you can do a simple join, i think you can do this



      SELECT * FROM T1 FULL OUTER JOIN T2 ON TRUE 


      or
      SELECT * FROM T1 , T2



      for everyting



      SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 <> T2.T1_C1
      for the unmatched



      SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 = T2.T1_C1
      for matched



      you can also change type of join for matching
      here the join documentation
      https://www.w3schools.com/sql/sql_join.asp
      you can also



      SELECT T1.C1, T2.C1,T1.C2, ..., CASE WHEN T1.C1=T2.T1_C1 THEN 'MATCH' ELSE 'NOT MATCH' END FROM T1,T2


      for have you result with the evidence of matching
      this is the documenation of case
      https://www.w3schools.com/sql/sql_case.asp






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        you can do a simple join, i think you can do this



        SELECT * FROM T1 FULL OUTER JOIN T2 ON TRUE 


        or
        SELECT * FROM T1 , T2



        for everyting



        SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 <> T2.T1_C1
        for the unmatched



        SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 = T2.T1_C1
        for matched



        you can also change type of join for matching
        here the join documentation
        https://www.w3schools.com/sql/sql_join.asp
        you can also



        SELECT T1.C1, T2.C1,T1.C2, ..., CASE WHEN T1.C1=T2.T1_C1 THEN 'MATCH' ELSE 'NOT MATCH' END FROM T1,T2


        for have you result with the evidence of matching
        this is the documenation of case
        https://www.w3schools.com/sql/sql_case.asp






        share|improve this answer












        you can do a simple join, i think you can do this



        SELECT * FROM T1 FULL OUTER JOIN T2 ON TRUE 


        or
        SELECT * FROM T1 , T2



        for everyting



        SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 <> T2.T1_C1
        for the unmatched



        SELECT * FROM T1 FULL OUTER JOIN T2 ON T1.C1 = T2.T1_C1
        for matched



        you can also change type of join for matching
        here the join documentation
        https://www.w3schools.com/sql/sql_join.asp
        you can also



        SELECT T1.C1, T2.C1,T1.C2, ..., CASE WHEN T1.C1=T2.T1_C1 THEN 'MATCH' ELSE 'NOT MATCH' END FROM T1,T2


        for have you result with the evidence of matching
        this is the documenation of case
        https://www.w3schools.com/sql/sql_case.asp







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 at 9:17









        David Marabottini

        1707




        1707















            Popular posts from this blog

            Bressuire

            Vorschmack

            Quarantine