I wrote this query showing number of orders today comparing to the number of orders yesterday. That part works fine. When I revised the query to include the current charges today comparing it to previous charges yesterday I am having trouble adding yesterdays revenue. Can someone point me in the right direction.
Text
select cs.Name CustName, cs.customercode AcctCode, salesperson.name SalesPr, cs.Contact CustContact, count(orderid) CurrOrders, sum(om.AmountCharged) as CurrCharges, m.CurrOrders as PrevVolume, convert(varchar,100*count(orderid)/m.CurrOrders-100)+'%' as ChangeOrderVolume from ordermain om join customer cs on cs.customerid=om.CustomerID join Salesperson on cs.SalespersonID=Salesperson.SalespersonID join( select cs.customerid, sum(om.AmountCharged) as CurrCharges,count(orderid) as CurrOrders from ordermain om join customer...