Prices of paper formats from MS SQL DB


Advanced question about pricelist (need to display prices of particular paper formats directly from MS SQL database).


Execute following query in SQL Server Management Studio:



select [format], sum(BlackwhiteImpression) as bw, sum(ReducedColourImpression) as reduced, sum(StandardColourImpression) as color, sum(price) as price
 from [Accountings] a
inner join copies c on a.Copy_Id = c.Id
where c.De vice_Id = 5 and c.[Type] <> 3 
and c.Finished > '2016-06-10 00:00:00'
group by [format]



Note: Value of c.Finished represents date and time since when the data are selected.