Calculate the Number of Line Items Sold for a Given Period

— Calculate the Number of Line Items Sold for a Given Period

— Variables below …
— Replace the soptype X with a 3 for an invoice and a 4 for a return
— Change the = ‘X’ to IN (‘3’, ‘4’) to include both invoices and returns
— Change the year(docdate) XXXX with the year
— Change the month(docdate) XX with the period designation
— Change the = ‘XXXX’ to IN (‘2015′,’2016’) to include multiple years
— Change the = ‘XX’ to IN (’01’, ’02’, ’03’) to include multiple months

select day(sop30200.docdate) [date] , count(sop30300.ITEMNMBR)[# of Lines]
from sop30200
inner join sop30300 on
sop30300.sopnumbe = sop30200.sopnumbe
where sop30200.soptype = ‘X’ and year(sop30200.docdate) = ‘XXXX’ and month(sop30200.docdate) = ‘XX’
group by sop30200.docdate
order by sop30200.docdate asc