Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: SELECT based on three bit fields?


Message #1 by "Paul Tillotson" <paultillotson@q...> on Tue, 26 Jun 2001 08:14:55 -0700
Paul:

Try the following:

  SELECT
    CustomerID,
    Response = CASE CONVERT(int, Response1) + 
                    CONVERT(int, Response2) + 
                    CONVERT(int, Response3)
                 WHEN 0 THEN 'No'
                 ELSE 'Yes'
               END
  FROM MyDB

Cheers.

- Roger Nedel

  Nedel Software Solutions
  Salt Lake City, UT
  rnedel@b...

==========================

> I would like to return a row in a SELECT statement based on 
> three bit fields.  If any one of the bit fields are 1 then return the 
> Response "YES" otherwise "NO". 
> I have tried a number of variations of the CASE but without success. 
>  
> Ie.
> SELECT response1, response2, response3
> from mydb 
> 
> Paul 
> 

  Return to Index