SHOW ALL TOTAL MATCHED RECORDS FROM 2 TABLES IF BOTH TABLES HAVE ONE COLUMN SAME

Hugh Jackman

Total Post:52

Points:366
Posted by  Hugh Jackman
 947  View(s)
Ratings:
Rate this:
Hi Expert!

I want to get total matched records from 2 tables. Tables and data are as following

tblOrderList_INDIA

Order_ID Product_ID Customer_ID Order_Date
----------------------------------------------------------
1 10001 90001 2013-12-12
2 10002 90002 2013-06-26
3 10003 90003 2013-06-26
4 10009 90001 2013-04-05
5 10015 90123 2013-04-15

tblOrderList_US

Order_ID  Product_ID Customer_ID Order_Date
----------------------------------------------------------
1 10009 90012 2013-04-05
2 10015 90150 2013-06-15
3 10008 90261 2013-09-21

I want to get match customer_id from both table(tblOrderList_INDIA, tblOrderList_US).

Please help.
Thanks in advance!


  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: show all total matched records from 2 tables if both tables have one column same

    Hi Hugh!


    Use Inner join to get matching data as following

    SELECT ind.Customer_ID as 'Customer_ID'  FROM tblOrderList_INDIA ind inner join tblOrderList_US us on ind.Product_ID = us.Product_ID

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!