Subject Re: How to Join to a Selectable Stored Procedure
Author jrodenhi
Alexandre,

Thank you very much. This works perfectly.

-Jack

> 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
>