July 4, 2007 at 4:27 am
Hey all, the following is an sql im running, at the moment it works but what i need is that when it comes across a NULL value in the ACTION_STATUS_KEY field instead of using the value from LAS.ACTION_STATUS_KEY it would use the value from A.ACTION_STATUS_KEY. any ideas? many thnks.
Scotty
SELECT
APPLICATION_KEY = A.APPLICATION_KEY,
SIRA_APPLICATION_KEY = A.SIRA_APPLICATION_KEY,
CLIENT_APPLICATION_ID = A.CLIENT_APPLICATION_ID,
APPLICATION_DATE = A.APPLICATION_DATE,
FORENAME = A.FORENAME,
SURNAME = A.SURNAME,
DATE_OF_BIRTH = A.DATE_OF_BIRTH,
HOUSE_NUMBER = A.HOUSE_NUMBER,
STREET = A.STREET,
POSTCODE = A.POSTCODE,
ACTION_STATUS = LAS.ACTION_STATUS_KEY,
UPDATED_BY = LAS.UPDATED_BY
FROM
#APP_SUMM A
left join
#LatestActionStatus LAS
ON
A.APPLICATION_KEY = LAS.APPLICATION_KEY
where updated_by is null
and ACTION_STATUS_KEY is null
July 4, 2007 at 4:41 am
hi
u can use the "case" for this.
"Keep Trying"
July 4, 2007 at 4:45 am
any hints on how it would look?
cheers
scotty
July 4, 2007 at 5:25 am
You can also try the is null option available.
ISNULL ( check_expression , replacement_value )
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
July 4, 2007 at 6:38 am
Or the COALESCE() function...
Paul
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply