Results 1 to 2 of 2

Thread: SQL Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    this is easier to explain with an example...

    I have a column in my table that contains either -1 or 0 and I want to retrieve it as either 'yes' for -1 or '' for 0. Is there any way to do this in an sql statement?

  2. #2
    Guest
    Use the CASE statement.

    SELECT NewValue =
    CASE Actualvalue
    WHEN -1 THEN 'Yes' WHEN 0 THEN 'No'
    ELSE 'Other'
    END
    from tablename

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width