I have written a table value function defined as:
CREATE FUNCTION [dbo].[ReadControlMeasurement]
-- Add the parameters for the function here
I want to call it for all the patients in my database that are women.
i can get all the women from the database using
select pat_id from Patients where gender = 'W'
i was thinking along the lines of using a cte:
with Women as
( select distinct pat_id from Patients where Gender = 'W' )
select B.* from Women W inner join dbo.ReadControlMeasurement( W.pat_id, 0, 1 ) B on W.pat_id = B.pat_id
but this does not seem to have a valid syntax.