Gaurav Singh Gaurav Singh - 2 months ago 6
SQL Question

How to fetch data from tables by using sql

Table_1

Id | name
1 | abc
2 | xyz


Table_2

Id|name
3|sgha
5|dshhb


I want to get all data from table 1 and i want data of only
Id
in table 2..

dhS dhS
Answer
SELECT
    COALESCE(Table_1.id, Table_2.id) AS id, Table_1.name
from Table_1
FULL OUTER JOIN Table2
ON Table_1.id = Table2.id

Maybe this will solve your problem..

COALESCE Function work here

Please do not downvote the question..