Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Sql Server Programming

Simple Query Help


I have a table with 3 columns MP4, 3G2 and 3GP, all of each have are
bit value types, e.g., True or False values.

MP4    |     3GP   |    3G2
False   |       True         |       False

I'm trying to create a select statement that will give me the first
column in the table that has a true value.

For example, considering the example above I would like my query to
return '3GP'.

Can somebody help me with this? Thanks.

If you have a single row, something like this will work:

                    WHEN [3GP] = 1 THEN '3GP'
                    WHEN [3G2] = 1 THEN '3G2'
FROM Foobar

For multiple rows you will get the first column with value 1 (if any) for
each row.


Plamen Ratchev


AHHH Case is what I was looking for. Thanks!

On May 29, 11:39 am, "Plamen Ratchev" <Pla@SQLStudio.com> wrote:

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc