Jump to content

[SOLVED] sum & count limit


poe

Recommended Posts

You're limiting the number of rows returned, NOT the number of rows considered by the count... if you want the latter, you'll need to derive a table without the aggregate functions, and then use SUM/COUNT on that (untested):

 

SELECT count(*) as cnt, sum(rf) FROM 
( SELECT rf FROM mlb_teamgbg WHERE stc = 22 ORDER BY datestamp DESC LIMIT 5 ) AS sub

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.