| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: extracting a sample of each condition
joel garry wrote:
> On Jul 24, 10:22 pm, DA Morgan <damor..._at_psoug.org> wrote:
>> Michel Cadot wrote:
>>> "jobs" <j..._at_webdos.com> a écrit dans le message de news: 1185328395.235116.113..._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
>> damor..._at_x.washington.edu (replace x with u to respond)
>> Puget Sound Oracle Users Groupwww.psoug.org
Sounds like an excellent opportunity for me to plug Oracle's wonderful FLASHBACK DATABASE capabilities. <g>
-- 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 Fri Jul 27 2007 - 01:54:53 CDT
![]() |
![]() |