Sunday, April 3, 2011

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
From stackoverflow
  • 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.

    msony : thank, i will try

0 comments:

Post a Comment