Advertisement
oquidave

group by query

May 12th, 2011
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. t_stamp | total_charge | count
  2. ---------------------+--------------+-------
  3. 2011-05-09 07:56:50 | 22650 | 1
  4. 2011-05-09 09:28:15 | 6450 | 1
  5. 2011-05-09 08:59:51 | 17850 | 1
  6. 2011-05-11 10:15:00 | 13050 | 1
  7. 2011-05-09 13:51:51 | 1950 | 1
  8. 2011-05-09 22:27:31 | 0 | 1
  9. 2011-05-09 23:47:58 | 29850 | 1
  10. 2011-05-10 09:17:33 | 150 | 1
  11. 2011-05-11 09:51:48 | 1350 | 1
  12. 2011-05-09 22:39:10 | 0 | 1
  13. 2011-05-09 15:31:07 | 0 | 1
  14. 2011-05-11 09:32:58 | 29400 | 1
  15. 2011-05-09 07:11:16 | 18750 | 1
  16. 2011-05-09 23:51:16 | 1650 | 1
  17. 2011-05-10 07:11:23 | 28650 | 1
  18. 2011-05-10 08:00:50 | 0 | 1
  19. 2011-05-10 17:02:39 | 25350 | 1
  20. 2011-05-09 22:06:13 | 5700 | 1
  21. 2011-05-09 22:47:59 | 0 | 1
  22. 2011-05-09 09:12:34 | 0 | 1
  23. 2011-05-10 09:00:13 | 4500 | 1
  24. 2011-05-09 22:26:59 | 0 | 1
  25. 2011-05-09 23:44:35 | 1800 | 1
  26. 2011-05-10 21:35:36 | 0 | 1
  27. 2011-05-09 15:12:13 | 2100 | 1
  28. 2011-05-10 09:07:28 | 15900 | 1
  29. 2011-05-09 15:28:22 | 8550 | 1
  30. 2011-05-10 15:40:19 | 10950 | 1
  31.  
  32. question?
  33. how can i create a query that groups by the date?
  34. i want to have 'total_charge' according to date.
  35.  
  36. here is my query
  37. select t_stamp, total_charge from mt.mt_batches where complete='t' and date(t_stamp) between 20110509 and 20110512;
  38.  
  39. thanks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement