Skip to content
Loading
+2
  • +2
    Here is what I want to acheive I have a table which contains personalinformation for both employee and customer is this form
    GivenName, LegalName,IsEmployee and isCustomer
     
    when I am selecting customer I want the result to be in the form of GivenName + LegalName as BusinessName this is easy so far
    the tricky part is that employee can be also be customer in this case if IsEmployee = 1 then I just want FirstName and LastName businessName will be null
    when businessname is customer =1 firstname and lastname will also be null 
    This is in the query result.
     
    I hope this make sense.
    +2
  • +2
    Below is the answer you are looking for
     
    select case IsEmployee   
        when 1   
            then firstname + ' ' + lastname   
        else firstname   
        end as FullName
    from Employee
    +2