1,2,3 SQL Query  
Author Message
Rosecowgirlla





PostPosted: Fri Sep 15 07:20:21 CDT 2006 Top

SQL Server >> 1,2,3 SQL Query

table: users
columns: IsOwner, IsAdmin, NetID
Query: create a fourth column As Logintype when,

IsAdmin = 'y' insert a "3"
IsOwner = 'y' insert a "2"
neither IsOwner or IsAdmin = 'y' insert a "1"
both IsOwner and IsAdmin = 'y' insert a "3"
Thanks..

SQL Server57  
 
 
Roy





PostPosted: Fri Sep 15 07:20:21 CDT 2006 Top

SQL Server >> 1,2,3 SQL Query SELECT IsOwner, IsAdmin, NetID,
CASE WHEN IsAdmin = 'y' THEN 3
WHEN IsOwner = 'y' THEN 2
ELSE 1
END as Logintype
FROM SomeTable

Roy Harvey
Beacon Falls, CT

On Fri, 15 Sep 2006 05:05:01 -0700, A388517


>table: users
>columns: IsOwner, IsAdmin, NetID
>Query: create a fourth column As Logintype when,
>
>IsAdmin = 'y' insert a "3"
>IsOwner = 'y' insert a "2"
>neither IsOwner or IsAdmin = 'y' insert a "1"
>both IsOwner and IsAdmin = 'y' insert a "3"
>Thanks..
 
 
A388517





PostPosted: Fri Sep 15 07:51:02 CDT 2006 Top

SQL Server >> 1,2,3 SQL Query Thanks so much. You were a great help, thanks again.
Rick.



> SELECT IsOwner, IsAdmin, NetID,
> CASE WHEN IsAdmin = 'y' THEN 3
> WHEN IsOwner = 'y' THEN 2
> ELSE 1
> END as Logintype
> FROM SomeTable
>
> Roy Harvey
> Beacon Falls, CT
>
> On Fri, 15 Sep 2006 05:05:01 -0700, A388517

>
> >table: users
> >columns: IsOwner, IsAdmin, NetID
> >Query: create a fourth column As Logintype when,
> >
> >IsAdmin = 'y' insert a "3"
> >IsOwner = 'y' insert a "2"
> >neither IsOwner or IsAdmin = 'y' insert a "1"
> >both IsOwner and IsAdmin = 'y' insert a "3"
> >Thanks..
>