Subject | Re: [firebird-support] help with subquery in SP |
---|---|
Author | Pavel Menshchikov |
Post date | 2006-03-12T14:01:52Z |
Hello Alan,
Try this:
-----
CREATE PROCEDURE GET_DELIVERIES_DAY (
FROMDATE DATE,
UPTODATE DATE)
RETURNS (
DATE_IN DATE,
TONNES_CONTRACT NUMERIC(9,3),
TONNES_ASL NUMERIC(9,3))
AS
BEGIN
for select date_in,
sum(case when contract_code<>11 then tonnes else 0 end),
sum(case when contract_code=11 then tonnes else 0 end),
from deliveries
where date_in>=:FromDate
and date_in<=:UpToDate
group by date_in
into :date_in, :tonnes_contract, :tonnes_asl
do
suspend;
END
-----
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com
Try this:
-----
CREATE PROCEDURE GET_DELIVERIES_DAY (
FROMDATE DATE,
UPTODATE DATE)
RETURNS (
DATE_IN DATE,
TONNES_CONTRACT NUMERIC(9,3),
TONNES_ASL NUMERIC(9,3))
AS
BEGIN
for select date_in,
sum(case when contract_code<>11 then tonnes else 0 end),
sum(case when contract_code=11 then tonnes else 0 end),
from deliveries
where date_in>=:FromDate
and date_in<=:UpToDate
group by date_in
into :date_in, :tonnes_contract, :tonnes_asl
do
suspend;
END
-----
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com