pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Query On Case structure
2+ messages / 2 participants
[nested] [flat]
* Re: Query On Case structure
@ 1970-01-01 00:00 Haller Christoph <ch@rodos.fzk.de>
parent: Dinesh Parikh <dineshp@newgen.co.in>
0 siblings, 0 replies; 2+ messages in thread
From: Haller Christoph @ 1970-01-01 00:00 UTC (permalink / raw)
To: dineshp@newgen.co.in; +Cc: 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
>
Looks fine to me. What do you want by asking "If yes then How is it."
Run the query and have a look on the result.
Regards, Christoph
^ permalink raw reply [nested|flat] 2+ messages in thread
* Query On Case structure
@ 2001-10-20 13:35 Dinesh Parikh <dineshp@newgen.co.in>
0 siblings, 1 reply; 2+ messages in thread
From: Dinesh Parikh @ 2001-10-20 13:35 UTC (permalink / raw)
To: pgsql-general@postgresql.org; 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-10-20 13:35 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-20 13:35 Query On Case structure Dinesh Parikh <dineshp@newgen.co.in>
1970-01-01 00:00 ` Haller Christoph <ch@rodos.fzk.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox