Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Impossible SQL Task ??

Re: Impossible SQL Task ??

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Sat, 01 May 1999 02:11:22 GMT
Message-ID: <373a5d97.10373818@netnews.worldnet.att.net>


You should be able to use the DECODE function. Try this:

	SELECT ID,
	                DECODE(code,'A',identifier,''),
	                DECODE(code,'B',identifier,'')
	FROM your_table;


On Fri, 30 Apr 1999 17:11:28 +0100, "Matt Randle" <matt_at_imat.demon.co.uk> wrote:

>We have a list of IDs / Codes / Identifiers as follows,
>
>ID Code Identifier
>
>1 A Matthew
>1 B Randle
>2 A Larry
>2 B Ellison
>3 A Dave
>4 B Some Surname
>
>We need to re-orient the table so it comes back as,
>
>ID A B
>
>1 Matthew Randle
>2 Larry Ellison
>3 Dave
>4 Some Surname
>
>Is this possible in SQL ?? I can obviously do it programatically but it
>would be more elegent to do it with on SQL statement ?? I seem to remember
>reading about some 'projection' facility availiable some SQL server that
>does this sort of thing.
>
>Cheers,
>
>Matt.
>
Received on Fri Apr 30 1999 - 21:11:22 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US