| From: | "Dinesh Parikh" <dineshp(at)newgen(dot)co(dot)in> | 
|---|---|
| To: | <pgsql-general(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org> | 
| Subject: | Query On Case structure | 
| Date: | 2001-10-20 13:35:26 | 
| Message-ID: | 001401c1596c$13af7350$f005a8c0@dinesh | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Barbara Ferrell | 2001-10-20 14:41:27 | Can Postgresql search full text fast through 3.3 million text documents? | 
| Previous Message | Peter Eisentraut | 2001-10-20 11:46:15 | Re: To Postgres Devs : Wouldn't changing the select limit | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Esteban Gutierrez Abarzua | 2001-10-20 18:05:44 | Re: GROUPING | 
| Previous Message | Aasmund Midttun Godal | 2001-10-20 11:15:48 | Re: oid's in views. |