IF Condition in an SQL query

if-statement, sql-server

Solution

select *
from table
where DATEDIFF(day, GETDATE(), maildate) = case when
    DATEPART(hour, GETDATE()) >= 16 then 1 else 0
end

Problem

I'm a newbie to SQL Server. Please help me to write the following Logic in a query. ``` If getnow() > today 4 PM Then SELECT * FROM table WHERE MailDate is Tomorrow Else SELECT * FROM table WHERE MailDate is Today ```

Original source