Re: [SQL] group by and order by

From: Damjan S. Vujnovic <damjan_at_NOSPAMgaleb.etf.bg.ac.yu>
Date: Mon, 20 Jan 2003 14:42:26 +0100
Message-ID: <b0gugs$fq1$1_at_news.etf.bg.ac.yu>


: Hi, how is it possible to order a group by query on a field that is
: aggregated ?
:
: I get the famous ORA-00979 error when i run this one :
:
: select ext_profil_id, ext_code, count(ext_log_date) as nb_connect
: from ext_log, extranet_pro where ext_log.ext_profil_id=
: extranet_pro.id and ext_action_id=1 group by ext_profil_id, ext_code
: order by ext_log_date

How about:

SELECT ext_profil_id, ext_code, COUNT(ext_log_date) as nb_connect FROM ext_log, extranet_pro
WHERE ext_log.ext_profil_id=extranet_pro.id AND ext_action_id=1 GROUP BY ext_profil_id, ext_code
ORDER BY nb_connect

regards,
Damjan S. Vujnovic

University of Belgrade
School of Electrical Engineering
Department of Computer Engineering & Informatics Belgrade, Yugoslavia

http://galeb.etf.bg.ac.yu/~damjan/ Received on Mon Jan 20 2003 - 14:42:26 CET

Original text of this message