In our database, we have a system set up to keep track of applications. We have a bool column that indicates whether or not the application is approved. Then there's another column that indicates whether or not the application is denied. If neither column is true, then the application is considered to be pending.
Is there any easy way to merge those into one value (like say a tinyint or maybe a string that says "approved", "denied", or "pending") in a view? Or is this going to require something like a Table-valued function?
UPDATE: It's difficult to choose an answer choose since they were all helpful. I'll go with baldy's since he posted first.
You can use a case statement like this:
select case
when Approved = 1 then 'Approved'
when Denied = 1 then 'Denied'
else 'Pending'
end 'Status'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With