If I have an sql statement:
select call_id, title, description, due_date
from calls
I want to include a column if the condition due_date < getdate()
is true.
I was thinking this column would be of type bit
, and be set to 1 if condition is true and 0 if condition is false.
Know how I can do this?
select
call_id,
title,
description,
due_date,
case when due_date < getdate() then 1 else 0 end
from calls
SELECT call_id, title, description, due_date,
CASE WHEN due_date < getdate() THEN CAST(1 AS BIT) ELSE 0 END overdue
FROM calls
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.