Re: how to get average value for top n records?

2001-04-15 Thread René Tegel
select sum(a)/3 from atable order by record_id desc limit 3; - Original Message - From: "Kevin Xin Lin" <[EMAIL PROTECTED]> To: "mysql" <[EMAIL PROTECTED]> Sent: Sunday, April 15, 2001 9:04 PM Subject: how to get average value for top n records? >

how to get average value for top n records?

2001-04-15 Thread Kevin Xin Lin
Hi, if I have a table with only one field A like this: record#1: 2 record#2: 3 record#3: 2 record#4: 4 record#5: 6 record#6: 8 How to write a sql statement to retrieve the average value of field A for the last 3 records? Did I make sense here? Thanks for help. -