Counting pages

From: "Justin Long" <justinlong(at)strategicnetwork(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Counting pages
Date: 1999-08-11 21:32:12
Message-ID: 001801bee440$f9878280$95421a9f@nsmjustinlong.cbn.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a question that I cannot seem to solve; I don't know if I should post
it here or somewhere else, but here goes.

I have a logbook database which tracks which pages are being accessed on our
site. I would like to know what the pages with the highest "hits" are. Each
time a page is hit, that page's ID # is stored in the database.

I've tried the following

SELECT l1.location, count(l2.location) from logbook l1, logbook l2
where l1.location = l2.location

That was just a guess but of course it didn't work. I've run into this
problem with some related issues; for example, I'd like to be able to give a
particular user a hot link to his/her most referenced page, deducing it in a
simlar way

SELECT u.userid, count(l.location) from logbook l, member u
where l.userid=u.userid

But this doesn't work either. I get an error message: 'Illegal use of
aggregates or non-group column in target list.' I've looked over the
documentation but either I'm going blind or stupid because I just don't get
it. Anyone else solved this one?

Thanks,
Justin Long

Never retreat. Never surrender. Never cut a deal with a dragon.
_______________________________________________________________
Justin Long CIO / Site Editor
616 Station Square Ct Network for Strategic Missions
Chesapeake, VA 23320 977 Centerville Trnpk CSB 317
JustinLong(at)xc(dot)org Va Beach, VA 23463
Check out our site at: http://www.strategicnetwork.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Charles Tassell 1999-08-11 23:12:33 Re: [GENERAL] Problem with compiled C
Previous Message Justin Long 1999-08-11 21:29:13 RE: [GENERAL] Oracle vs. Postgres