SELECT orderno FROM saletable
UNION
SELECT orderno FROM saledetail
This is to show distinct value from the 2 tables by merging those duplicated values.
Eg,
OrderNo.SaleTable
SO1
SO2
OrderNo.SaleDetail
SO1
SO1
SO2
output will be: SO1, SO2 total record is 2
SELECT column_name(s) FROM table1
UNION ALL
SELECT column_name(s) FROM table2;
This is to include those duplicated values from above tables:
output will be : 5 records
UNION
SELECT orderno FROM saledetail
This is to show distinct value from the 2 tables by merging those duplicated values.
Eg,
OrderNo.SaleTable
SO1
SO2
OrderNo.SaleDetail
SO1
SO1
SO2
output will be: SO1, SO2 total record is 2
SELECT column_name(s) FROM table1
UNION ALL
SELECT column_name(s) FROM table2;
This is to include those duplicated values from above tables:
output will be : 5 records
No comments:
Post a Comment