Guest User

Untitled

a guest
Jul 31st, 2018
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. sum of customer transactions
  2. 1 Deal Certificate int(3)
  3. 2 Purchase Price decimal(4,2)
  4. 3 Purchase Date timestamp
  5. 4 Serial Number varchar(9)
  6. 5 Name varchar(23)
  7. 6 Email varchar(42)
  8.  
  9. SELECT *
  10. FROM `PURCHASES`
  11. WHERE `Purchase Date`
  12. between '2012-01-01' and '2012-01-31'
  13. order by email
  14.  
  15. 345 36.00 2012-01-17 16:42:33 7757-3097 T T [email protected]
  16. 327 6.00 2012-01-05 10:40:57 0223-3945 R T [email protected]
  17. 329 12.00 2012-01-02 04:54:45 1087-7072 P B [email protected]
  18. 294 7.00 2012-01-02 04:59:11 4144-2426 P B [email protected]
  19. 285 6.00 2012-01-02 05:12:39 8027-1641 P B [email protected]
  20. 1079 21.00 2012-01-02 05:05:07 2447-7971 P B [email protected]
  21. 331 10.00 2012-01-02 19:14:38 3916-5434 y a [email protected]
  22.  
  23. 345 36.00 2012-01-17 16:42:33 7757-3097 T T [email protected]
  24. 327 6.00 2012-01-05 10:40:57 0223-3945 R T [email protected]
  25. 329 46.00 2012-01-02 04:54:45 1087-7072 P B [email protected]
  26. 331 10.00 2012-01-02 19:14:38 3916-5434 y a [email protected]
  27.  
  28.  
  29. select sum(`Purchase Price`) as total_sum, name, email from purchases
  30. where `Purchase Date` between '2012-01-01' and '2012-01-31'
  31. group by email, name
  32. order by email
  33.  
  34. SELECT `Deal Certificate`,
  35. sum(`Purchase Price`) as sum_price
  36. `Purchase Date`,
  37. `Serial Number`,
  38. Name,
  39. Email
  40. FROM PURCHASES
  41. WHERE Purchase Date between '2012-01-01' and '2012-01-31'
  42. group by `Deal Certificate`
  43. order by email
Add Comment
Please, Sign In to add comment