Counting pages

Поиск
Список
Период
Сортировка
От Justin Long
Тема Counting pages
Дата
Msg-id 001801bee440$f9878280$95421a9f@nsmjustinlong.cbn.org
обсуждение исходный текст
Ответ на Re: [GENERAL] Oracle vs. Postgres  ("Jonathan davis" <haj@idianet.net>)
Список 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@xc.org             Va Beach, VA 23463
Check out our site at:        http://www.strategicnetwork.org


В списке pgsql-general по дате отправления:

Предыдущее
От: "Justin Long"
Дата:
Сообщение: RE: [GENERAL] Oracle vs. Postgres
Следующее
От: Charles Tassell
Дата:
Сообщение: Re: [GENERAL] Problem with compiled C