Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Distinct string statement
Paul Izzo wrote:
> 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"
> ...
And I feel for your employer if this is your approach to solving the problem.
Lets see ... I have a zillion rows of data and Paul is going to manually read through each and every value and then hard code a UNION.
Hope you get paid by the hour.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Tue Feb 22 2005 - 12:59:33 CST