Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: GROUP BY

Re: GROUP BY

From: <paul.hennebry_at_bzw.com>
Date: 1998/03/13
Message-ID: <6ebbra$ae3$1@nnrp1.dejanews.com>#1/1

In article <35080863.26336515_at_news.planetinternet.be>,   kaho_at_planetinternet.be (Koen Serry) wrote:
>
> our table looks like this
>
> CREATE TABLE pagehits
> (
> host_id NUMBER(3) NOT NULL,
> url_id NUMBER(5) NOT NULL,
> datum DATE NOT NULL,
> aantal NUMBER(8) DEFAULT 0
> )
>
> we're trying to select data grouped by "day"
> what's wrong with this
>
> 'SELECT sum(aantal)
> FROM pagehits
> WHERE (datum = (SYSDATE-1))
> AND (hostid(host)=host_id)
> GROUP BY datum date(50) "dd/mon/yyyy"
>
> regards,
>
> Koen & Bart
>

try:
select datum, sum(aanatal)
from pagehits
group by datum;

The group by clause has to laid out in the same fashion as your select :

select col1, col2, col3, sum (col4)
from tab1
group by col1, col2, col3

Good Luck!

paul

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Fri Mar 13 1998 - 00:00:00 CST

Original text of this message

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