Skip to Content
Former Member
Jun 13, 2009 at 12:38 PM

Query Help


I got this query from the Forum and I tried to add in 3 Parameters,

[%0] for BP Name

[%1] for Start Date

[%2] for End Date

But it keeps giving me errors, any help is much appreciated.

select cardname, itmsgrpnam, sum(linetotal) as 'Total' from

(select inv1.docentry, inv1.itemcode, inv1.linetotal, oitm.itmsgrpcod,oitb.itmsgrpnam, oinv.cardname, oinv.docdate

from inv1 join oinv on inv1.docentry = oinv.docentry

join oitm on inv1.itemcode = oitm.itemcode

join oitb on oitm.itmsgrpcod = oitb.itmsgrpcod

) invoicedSalesWithGroup

where cardname like [%0] and CONVERT(nchar(8), oinv.docdate, 112) >= [%1] AND CONVERT(nchar(8), oinv.docdate, 112) <= [%2]

group by cardname, itmsgrpnam

order by cardname, itmsgrpnam