Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Distinct string statement
DA Morgen,
Do you every have anything to say other than "this looks like homework"? You've said the same thing so many times in so many threads.
Marina I feel for you. You have a genuine problem and some bozo's say it's homework but give no help in return.
Being once a victim to this I'll help you out.
In order to do your create your UNION statement you need to know what your up against. Do a couple queries in order to:
select
count(id)
from table_name
group by id
select
id,count(symbol)
from table_name
where id = 'id'
group by symbol
The output from these 2 queries you can put into a cursor. I guess that you might be able to do this all in 1 cursor but that beyond me (perhaps someone might be able to help out on this) (But not D A Morgen)
Or you can put all of the triplet possiblilties that you recieved from your queries and put them into a SELECT statement using UNION like Malcolm states using DISTINCT. The final query should look something like this:
select distinct symbol
from table_name
where symbol = "abc"
union
and symbol = "def"
...
Received on Tue Feb 22 2005 - 08:43:33 CST