select SUM (Bill) from ProductSaleReport group by PCI
having MONTH(Date) between 1 and 3
Could any one please help me finding the issue.?
<
MONTH(Date)
is not a column you SELECT
ed, so it can't appear in your HAVING
clause.
If you meant to only SUM
the Bill
s from rows where the month is between 1 and 3, then that is a WHERE
clause, not a HAVING
clause.
If all the rows in each PCI
group have the same MONTH(Date)
, then you can add MONTH(Date)
to your SELECT
clause in order to use it in the HAVING
clause.