July 28, 2006 at 1:07 pm
Hello All,
I am creating a view, with amongst other fields has the columns startdate and enddate.
I wish to populate another field with the value 1 when these two fields are the same Eg When startdate = enddate and a zero when the fields do not match.
Could you possibly let me know how this is done.
Many thanks.
Nick
July 28, 2006 at 1:11 pm
you could use a CASE statement. check outBOL for syntax. aproxly:
SELECT
...
CASE WHEN startdate=Enddate THEN 1 ELSE 0 END
FROM
...
******************
Dinakar Nethi
Life is short. Enjoy it.
******************
July 30, 2006 at 4:21 pm
if you are creating a view, you need to named the new field
SELECT
...
CASE WHEN startdate=Enddate THEN 1 ELSE 0 END as new_field
FROM
...
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply