sql - Using a select case statement to compare field values -
i using select case statement compare 2 columns. 1 value returned table valued function , other database column. if first value of preferred first name null need show value of firstname view aliased column. dont know if syntax right. can tell me if right , or better way it?
(select case when ( select asstring dbo.getcustomfieldvalue('preferred first name', view_attendance_employees.filekey) ) = null view_attendance_employees.firstname else ( select asstring dbo.getcustomfieldvalue('preferred first name', view_attendance_employees.filekey)) end) firstname,
you can use isnull function here:
select isnull(.. massive subquery here..., firstname)
Comments
Post a Comment