0

私には2つの機能があります:

fn_get_AB_associations(Date from, Date to, Int AentityId)

次のフィールドを使用して結果セットを取得します。

datefrom | AentityId | BentityId

fn_get_BC_associations(Date from, Date to, Int BentityId)

次のフィールドを使用して結果セットを取得します。

datefrom | BentityId | CentityId

日付範囲で、A エンティティに関連付けられているすべての C エンティティを選択する必要があります。

私は次のようなことをしようとしていました:

select DISTINCT T1.BentityId from dbo.fn_get_AB_associations('2013-04-01', '2013-04-15', 'PF')  T1
INNER JOIN fn_get_BC_associations('2013-04-01', '2013-04-15', T1.BentityId)  T2
ON T1.BentityId = T2.BentityId

しかし、明らかにこのエラーが発生します:The multi-part identifier "T1.BentityId" could not be bound.

それで...この2つの結果セットを結合する方法はありますか、それとも最初の関数の結果を循環させて、それぞれに対して2番目の関数を呼び出す必要がありますか?

4

1 に答える 1