Query On Case structure - Mailing list pgsql-sql

From Dinesh Parikh
Subject Query On Case structure
Date
Msg-id 001401c1596c$13af7350$f005a8c0@dinesh
Whole thread Raw
Responses Re: Query On Case structure
List pgsql-sql
Hi All,
Can we create a query to find different values based on different criteria from a table using case structure. For example
 
Select Into DBComment
        Case When localComment Is Null Then Comment
                When localComment = '123' Then 'Numeric Comment'
                Else 'String Comment'
        End    
From PDBUser
Where UserIndex = 23;
 
Using such type of structure can we evaluate multiple values. e.g
 
Select DBComment , DBName
        Case When localComment Is Null Then Comment
                When localComment = '123' Then 'Numeric Comment'
                Else 'String Comment'
        End,   
        Case When localName Is Null Then UserName
                When localName = 'SuperUser' Then 'Supervisor'
                Else 'NormalUser'
        End    
From PDBUser
Where UserIndex = 23;
 
 
Is this possible. If yes then How is it.
Any help/suggestion may be benificial.
 
Regards
Dinesh Parikh
NSTL New Delhi

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Table Constraints with NULL values
Next
From: Esteban Gutierrez Abarzua
Date:
Subject: Re: GROUPING