Your question, your audience. Choose who sees your identity—and your question—with question security.
I want to call it for all the patients in my database that are women.
CREATE FUNCTION [dbo].[ReadControlMeasurement] ( -- Add the parameters for the function here @pat_id int, @StartMonth int, @EndMonth int )
i was thinking along the lines of using a cte:
select pat_id from Patients where gender = 'W'
but this does not seem to have a valid syntax.
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