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: Q: SQL -Only the first of every row ?

Re: Q: SQL -Only the first of every row ?

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Wed, 04 Aug 2004 20:22:06 -0700
Message-ID: <1091676162.819587@yasure>


Frank Dietrich wrote:

> Hi Ralf,
> 
> Ralf Bender schrieb:
> 

>> I got a little problem to solve. There is a table like this:
>> objectnr, names, dates
>> 123,data1,2004
>> 123,data1,2003
>> 234,data2,2003
>> 456,data3,2004
>> 456,data4,2004
>>
>> Now i want to select all rows which have 2004 in field dates, BUT i
>> only want to see every objectnr once and all columns.
>>
>> The result should look like this:
>> 123,data1,2004
>> 456,data3,2004
> 
> 
> select objectnr, names, dates
>   from $your_table
>  where dates=2004
>  group by objectnr
> 
> regards
> Frank

Look up information on the proper use of GROUP BY.

You have no aggregation taking place.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Wed Aug 04 2004 - 22:22:06 CDT

Original text of this message

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