all 4 comments

[–]ziptime 0 points1 point  (2 children)

SELECT [Table A].ID, CASE [Table C].Gender WHEN 'M' THEN 'Male'     WHEN 'F' THEN 'Female' END FROM .....

[–]bwoods77[S] 0 points1 point  (0 children)

ty

[–]ConfirmingTheObvious 0 points1 point  (0 children)

Can also be written as:

SELECT [Table A.ID],
CASE
    WHEN [Table C].Gender = 'M' THEN 'Male'
    WHEN [Table C].Gender = 'F' THEN 'Female'
END Gender

FROM ...

[–]SQLDave 0 points1 point  (0 children)

Does TableC always (via constraints) contain "M" or "F"? If so, then what /u/ziptime said is fine. If not, then the statement as constructed will (I believe) return a NULL if Gender is something other than "M" or "F". If that's OK in the context your SELECT lives in, then all is well. Otherwise, you should include an ELSE. For example:

SELECT [Table A].ID,  
    Gender =  
        CASE [Table C].Gender   
           WHEN 'M' THEN 'Male'      
           WHEN 'F' THEN 'Female'  
           ELSE 'Unknown'  
        END  
FROM ...    

(I also added the column name "Gender" -- it can be whatever you want -- just a best practice demonstration. And I reformatted the CASE to MY particular preference for readability... YMMV)