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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Distinct string statement

Re: Distinct string statement

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 21 Feb 2005 13:25:38 -0800
Message-ID: <421a51d2@news.victoria.tc.ca>


Marina S. (marina.sukhnev_at_thinknet.com) wrote:
: Hi,

: I have some question,

: I have table with 2 columns

: id symbol

: 11 abc,bbc,abf,cde
: 22 rda,abc,aig
: 33 ibm,aig,sun
: 55 aig,klm,suk,sun
: 23 bbc,kln,sun,adf
: .. ..
: .. ..

: I need to select distinct symbol strings from symbol column,they
: shoudn't be repeated,but should be comma separated as they appear in a
: column.
: the result to user should be like:
: abc,bbc,abf,cde,rda,aig,ibm,sun,klm,suk,kln,adf...

: Any ideas are really appreciated,

I assume there is a maximum number of triplets in each symbol.

So write a query to pull out all the first triplets (using various char functions), and all the second triplets, and etc.

UNION them all together. That allows you to use distinct and to ignore null triplets.

Last problem is just to display them on the same line. Here I'll assume that the display is just a reporting issue, so output the results as individual lines, but using a formatting (html or whatever) that will end up as a single line of display.

(e.g. in html

	abc,
	bbc,

etc would create a single line of display).

How to get rid to one extra comma at the end is not immediately clear.

--

This space not for rent.
Received on Mon Feb 21 2005 - 15:25:38 CST

Original text of this message

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