I have the following query:
WITH matching_data as (
select * from consultants_matching_data_for_project(6001)
)
select
id,
matching_data.city_matching
from
consultant_profiles
LEFT OUTER JOIN matching_data on matching_data.consultant_profile_id = consultant_profiles.id;
Is there any other way to join with matching_data result without using a WITH clause?
3
Answers
It seems like suquery works fine:
You can move the function call directly to the
from
clause of the outer query:From the documentation:
There was no need for the CTE anyway, nor a subquery. You can use the function just like a table: