2007年12月11日 星期二

MySQL--SUM Function with LIMIT

http://forums.mysql.com/read.php?10,105508,105543#msg-105543

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;

沒有留言:

張貼留言