is it possible to make a query that returns a different custom value based on a query. its hard to explain, here is an example that should make it more clear.
what I have in the table:
here is what I want returned:
something like an if statement...
You want a case statement. Depending on your flavor of SQL, something like this should work:
select 
    bar = case 
               when foo = 1 then 'one'
               when foo = 2 then 'two'
               else 'baz' 
          end
from myTable 
                        Try
select value = case t.value
               when 1 then 'one'
               when 2 then 'two'
               when 3 then 'three'
               ...
               else null
               end
from my_table t
                        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