Thursday, May 2, 2013

query to display sales report from from two tables using join

Sales Person Table

salesperson

Sales Report Table

salesorder

Result


Query
SELECT count(so.P_Id) as No_of_Sales,
sp.* FROM `salesorder` as so,`salesperson` as sp 
WHERE so.P_Id=sp.P_Id 
group by sp.P_Id