Subject RE: [firebird-support] SP To Compute Sales Report
Author Bill Meaney
Muthu,

Try changing the group by to:

GROUP BY CAST(RECEIPT.RECEIPTDATE AS DATE)

I assume the RECEIPT.RECEIPTDATE has the time also.

Bill Meaney

=============================================================
Dear Friends,

I need help with my SP. I have given my SP below.
----------------------SP------------------------
CREATE PROCEDURE REPORTWEEKSALES
( FROMDATE DATE )
RETURNS
(
SALESDAY DATE,
RECEIPTS INTEGER,
SALES DECIMAL(18,2),
AVERAGESALES DECIMAL(18,2)
)
AS

BEGIN

FOR SELECT CAST(RECEIPTDATE AS DATE),
COUNT(CAST(RECEIPT.RECEIPTNUMBER AS INTEGER)),
SUM(RECEIPT.AMOUNT),
AVG(RECEIPT.AMOUNT)
FROM RECEIPT
WHERE CAST(RECEIPT.RECEIPTDATE AS DATE)
BETWEEN :FROMDATE AND :FROMDATE + 6
GROUP BY RECEIPTDATE
INTO :SALESDAY,:RECEIPTS,:SALES,:AVERAGESALES

DO SUSPEND;
END
---------------------SP end-------------------------

This SP is returning

salesday receipts sales averagesales
18.6.2004 1 50 50
18.6.2004 1 45 45

What I want is

salesday receipts sales averagesales
18.6.2004 2 95 47.5

Need Help

Thanks

Muthu Annamalai







Yahoo! Groups Links