Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- date | sum
- ------------+-------
- 2011-04-29 | 34350
- 2011-04-28 | 34650
- 2011-04-27 | 34050
- 2011-04-26 | 35550
- 2011-04-25 | 34800
- 2011-04-23 | 36750
- 2011-04-22 | 37800
- 2011-04-21 | 35550
- 2011-04-20 | 35850
- 2011-04-17 | 34050
- 2011-04-16 | 36150
- 2011-04-13 | 36450
- 2011-04-11 | 32100
- 2011-04-10 | 36600
- 2011-04-09 | 41400
- 2011-04-06 | 38100
- 2011-04-05 | 35250
- 2011-04-04 | 35400
- 2011-04-03 | 36150
- 2011-04-02 | 36000
- 2011-04-01 | 0
- 2011-03-31 | 36300
- 2011-03-30 | 36300
- 2011-03-25 | 37200
- //query
- select date(t_stamp), sum(total_charge) from mt.mt_batches where complete='t' and keyword='pablo'and date(t_stamp) between '2011-01-01' and '2011-04-30' group by date(t_stamp) order by date(t_stamp) desc;
- //question
- i want 0 value entered for the dates that are not there.
- like this
- date | sum
- ------------+-------
- 2011-04-30 | 0 (not present, has no value)
- 2011-04-29 | 34350
- 2011-04-28 | 34650
- 2011-04-27 | 34050
- 2011-04-26 | 35550
- 2011-04-25 | 34800
- 2011-04-23 | 36750
- 2011-04-22 | 37800
- 2011-04-21 | 35550
- 2011-04-20 | 35850
- 2011-04-19 | 0(not present, has no value)
- 2011-04-18 | 0(not present, has no value)
- 2011-04-17 | 34050
- 2011-04-16 | 36150
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement