MySQL Forums
Forum List  »  Newbie

Re: SUM Function with LIMIT
Posted by: Bob Field
Date: July 29, 2006 08:06AM

The LIMIT clause affects only the number of rows returned, and this query in fact only returns one row. You might want to try something like this:
SELECT sum(quantity) 
FROM (SELECT quantity
      FROM stock_card
      LIMIT 0,2
) AS subquery;

Options: ReplyQuote


Subject
Written By
Posted
July 28, 2006 11:17PM
Re: SUM Function with LIMIT
July 29, 2006 08:06AM
August 02, 2006 11:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.