mysql - How to add a condition to the result of an SQL query? -
i have table,
date_of_order|quantity 01/01/17 | 1 02/01/17 | 1 04/01/17 | 1 05/01/17 | 1
i need sum of quantities before 03/01/17, result of sql query include condition date if not in table, this:
03/01/17 2
i know how show sum:
select sum(quantity) table_name date_of_order < '2017-01-03'
but how include date(03/01/2017) result?
thanks!
just add separate column:
select '2017-01-03' datestart, sum(quantity) table_name date_of_order < 2017-01-03
Comments
Post a Comment