The case statement in this SQL statement is not returning the correct results. It is returning all 1's.
Can someone point me in the direction where I am going wrong with this. It run's so it's not a syntax error.
Can anyone see what I am doing wrong? When I run this query, it always returns 1. (Even though I have records that have a created_date after 4:30 pm.
SELECT [accession_no] AS [Accession Number],
[created_date] AS [Date Case Created]/
( CASE
WHEN CONVERT(TIME(0), created_date) <= '16:30:00'
THEN 1
ELSE 0
END) AS 'Casesbefore430'
FROM [PowerPath].[dbo].[accession_2] a
WHERE (created_date >= '02/01/2022' AND created_date <= DATEADD(dd, 1, '2/22/2022'))