I need a query that I don't know how should be written. I pass in an AdmissionKey. if it is null then I want that line of the sql to be omited how can this be done? I have tried IIF ,IF/THEN and CASE when. but nothing will insert/omit the portion of the SQL Statement.
GROUP BY PgmDocID,AdmissionKey,DateService,ProgName,AdmDate,MedStaff,OP__DOCID