Sasha
Sasha

Reputation: 20834

Expression inside select

i have simple table with two fields: ID and Date

how can i do Select that will return true or false, of course without Scalar-valued Functions

it must be something like that:

SELECT (Date < getdate()) as mu_value FROM my_table

Upvotes: 0

Views: 71

Answers (1)

Amy B
Amy B

Reputation: 110111

I use something like:

SELECT
  CASE
    WHEN mt.Date < getDate() THEN 1
    ELSE 0
  END as mu_value
FROM my_table mt

Of course, you can substitute whatever you like for 1 and 0.

Upvotes: 4

Related Questions