Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: extracting a sample of each condition
Michel Cadot wrote:
> "jobs" <jobs_at_webdos.com> a écrit dans le message de news: 1185328395.235116.113380_at_w3g2000hsg.googlegroups.com...
> | Hello.
> |
> | Say i have a table that looks like this:
> |
> | name date plan type1 type2 type3 amount
> |
> | it's unique by name
> |
> | I'd like the first record of every of every combination of
> |
> | plan type1 type2 type3
> |
> | Can somebody help with the SQL for that?
> |
> | Thanks for any help or information.
> |
>
> Have a look at row_number/rank/dense_rank functions.
> First_value one may also help.
>
> Regards
> Michel Cadot
And in the future, jobs, run this query before creating objects:
SELECT keyword
FROM gv$reserved_words
WHERE keyword IN ('NAME', 'DATE', 'PLAN');
3 of out 3.
I'd suggest you google "Joe Celko" and "column names" as not a single one of your column names is correctly named.
Name is name of what? person_name? place_name? species_name? Date is date of what? registration_date, termination_date? date_deceased? And you should apply the same logic to the rest of them too.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Wed Jul 25 2007 - 00:22:02 CDT