Subject | RE: [firebird-support] How to Join to a Selectable Stored Procedure |
---|---|
Author | Rick Debay |
Post date | 2006-07-21T21:22:32Z |
I didn't know you could pass parameters from other tables in to a stored
procedure inside a query. This will be very useful.
BTW, what error will you get if you don't use an outer join?
-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Alexandre Benson
Smith
Sent: Wednesday, July 19, 2006 4:10 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] How to Join to a Selectable Stored
Procedure
[SNIP]
Jack,
You could join to SP's the join condition will vary acording to what you
procedure returns.
if your SP returns only a sub-set that is already related to the Detail
table, then you just could use 1=1 as the join condition.
but use left join to force the table to be processed before the SP
otherwise you will get an error, something like this:
SELECT t.Description, d.CurrentAmount, sp.YTDAmount FROM Detail d INNER
JOIN PayType t ON t.hKey = d.hPayType LEFT JOIN sp_YTDAmt(d.hCheck,
d.hPayType) sp ON 1=1
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
procedure inside a query. This will be very useful.
BTW, what error will you get if you don't use an outer join?
-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Alexandre Benson
Smith
Sent: Wednesday, July 19, 2006 4:10 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] How to Join to a Selectable Stored
Procedure
[SNIP]
Jack,
You could join to SP's the join condition will vary acording to what you
procedure returns.
if your SP returns only a sub-set that is already related to the Detail
table, then you just could use 1=1 as the join condition.
but use left join to force the table to be processed before the SP
otherwise you will get an error, something like this:
SELECT t.Description, d.CurrentAmount, sp.YTDAmount FROM Detail d INNER
JOIN PayType t ON t.hKey = d.hPayType LEFT JOIN sp_YTDAmt(d.hCheck,
d.hPayType) sp ON 1=1
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br