php - How to add multiple limits in mysql query? -
i want select sum of last 200,100 , 50 rows of close price table in single query. given below query 200 rows.
select sum(close_price) tot200 cash_data order date_added limit 0,200
can me this.
you can use sub queries -
select (select sum(close_price) cash_data order date_added limit 0,200) tot200, (select sum(close_price) cash_data order date_added limit 0,100) tot100, (select sum(close_price) cash_data order date_added limit 0,50) tot50
Comments
Post a Comment