0

I was wondering if someone knew of a way to exclude the third Wednesday of each month from my SQL code using the appointment date?

SELECT
    appointment_date,
    appointment_sequence,
    appointment_type,
    appointment_type_code,
    local_treatment_function,
    data_as_at
FROM
    SC_TrakCare_live.dbo.vw_clinic_slots_P14N 
WHERE
    resource_code = 'GNK'
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Shez
  • 1
  • 1
  • 4
  • 1
    `where not (week_of_month(appointment_date) = 3 and datepart(dw, appointment_date) = 3)`, where `week_of_month` is https://stackoverflow.com/q/13116222/11683? – GSerg Feb 21 '21 at 23:26
  • 3
    One method: `NOT (DATENAME(weekday, appointment_date) = 'Wednesday' AND DATEPART(day, appointment_date) BETWEEN 15 AND 21)` – Dan Guzman Feb 21 '21 at 23:33

0 Answers0