Display data from multiple select statements
Posted on 2016-09-14
Need to be able to query an SQL Database for sales figures from 2013,2014,2015, and 1/1/2016 to 8/30/2016
Ideally I would like to get in return the following columns:
slsperid,CustId, Name, TotalPurch2013,TotalPurch2014,TotalPurch2015,TotalPurch2016
Here is the query I normally would use to return:
slsperid,CustId, Name, TotalPurch
sum(a.TotInvc) as TotalPurch
from SOShipHeader a,Customer b
and a.Status ='C'
and b.SlsperID like '%'
group by b.custid,b.SlsperId,B.name,b.phone,b.fax,b.ClassId
order by b.custid
Your assistance in formatting this query to get the return data set would be greatly appreciated.