Reputation: 89
I am trying to join 2 table-valued functions using a common column returned by each function respectively.
I am trying to do something like this :
Select * from function1(),function2() where id=1;
When I do this I get the error saying the column is ambigiuos as it is present in both the set of columns retuned.
How can I join these 2 table-valued functions?
Upvotes: 0
Views: 49
Reputation: 1269873
You can. But as with anything else in the from
clause, table valued functions need to given aliases. And: Never use commas in the FROM
clause.
So:
select *
from function1() f1 join
function2() f2
on f1.id = f2.id;
Upvotes: 2