Cus_id(primary key)
Cus_Name
Cus_id Cus_Name --------------- 101 xxxx 102 ABC 103 XXXX
Regis_id,Cus_id(foreign Key),and sale_amount
Regis_id Cus_id sale_amount ------------------------------ --- 1 101 23000
Cus_id Sales_Amount -------------------- 101 23000 102 103
select a.cus_id,b. Sales_Amount from Table1 as a Left join table2 on a.Cus_id=b.Cus_id
SELECT t1.Cus_id, t1.Cus_Name, SUM(t2.Amount) AS Amount FROM Table1 AS t1 LEFT JOIN Table2 AS t2 ON t1.Cus_id = t2.Cus_id GROUP BY t1.Cus_id
select a.Cus_id,b.sale_amount from table2 b right join table1 a on b.Cus_id=a.Cus_id
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)