Message from discussion
Select X of of Y in Aggregation
Path: g2news2.google.com!postnews.google.com!h3g2000cwc.googlegroups.com!not-for-mail
From: "howa" <howac...@gmail.com>
Newsgroups: comp.databases.mysql
Subject: Select X of of Y in Aggregation
Date: 25 Feb 2007 20:39:46 -0800
Organization: http://groups.google.com
Lines: 25
Message-ID: <1172464786.779436.114580@h3g2000cwc.googlegroups.com>
NNTP-Posting-Host: 125.215.205.194
Mime-Version: 1.0
Content-Type: text/plain; charset="big5"
X-Trace: posting.google.com 1172464793 408 127.0.0.1 (26 Feb 2007 04:39:53 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 26 Feb 2007 04:39:53 +0000 (UTC)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: h3g2000cwc.googlegroups.com; posting-host=125.215.205.194;
posting-account=9wtD4g0AAACU3YlOCEKpT07iD6123Ajo
Consider a table like:
user_id score
1 90
1 80
1 70
2 85
2 80
2 80
.
.
I want to select te average score of a user and will use sth
like:
SELECT avg( score )
FROM `score`
GROUP BY user_id
but sometimes, i want to select the average, but dropping the lowest N
score, how
to write the query?
thanks