Subject Re: Group By in For Select
Author Muthu Annamalai
I tried as you said by grouping all columns in the select and it is
working.

Thanks

Muthu Annamalai


--- In firebird-support@yahoogroups.com, "Ann W. Harrison"
<aharrison@...> wrote:
>
> Muthu Annamalai wrote:
> > I have this following Stored Procedure and I need to group by a
> > column but I am getting Invalid expression in Select List error
> >
> > FOR SELECT RECEIPTDATE, RECEIPTDETAILS.ID, ITEMSTYLEID,
> > SUM(RECEIPTDETAILS.QUANTITY * RECEIPTDETAILS.PRICE)
> > FROM RECEIPT, RECEIPTDETAILS
> > WHERE RECEIPT.ID = RECEIPTDETAILS.RECEIPTID AND
> > RECEIPT.RECEIPTDATE BETWEEN :FROMDATE AND :TODATE
> > GROUP BY 3
> > INTO SALESDATE, RECEIPTDETAILSID, ITEMSTYLEID, SALES
> > DO
> > BEGIN
> > /* Code removed for simplicity */
> > SUSPEND;
> > END
> >
>
> You're grouping by ItemStyleID, but reference ReceiptDate
> in the select list without aggregating it.
>
> Try either GROUP BY 1, 3 or SELECT MAX(ReceiptDate) ...
>
>
> Regards,
>
>
> Ann
>