Guest User

Untitled

a guest
Jul 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. | id | artikel | einzelpreis | gesamtpreis | name | intervall | anzahl | domain | start | bezahltbis
  2. | 1 | ABC123 | 5 | 20 | VPS | 12 | 4 | example.de | 2000-01-01 | 2008-12-31
  3. | 2 | ABC456 | 15 | 30 | Web-Paket A | 1 | 2 | example.com | 2000-01-01 | 2008-12-31
  4. | 3 | ABC789 | 2 | 10 | Spamschutz | 12 | 5 | example.de | 2000-01-01 | 2008-12-31
  5. | 1 | ABC123 | 5 | 20 | VPS | 12 | 4 | example.de | 2000-01-01 | 2009-12-31
  6. | 2 | ABC456 | 15 | 30 | Web-Paket A | 1 | 2 | example.com | 2000-01-01 | 2009-12-31
  7. | 3 | ABC789 | 2 | 10 | Spamschutz | 12 | 5 | example.de | 2000-01-01 | 2009-12-31
  8. | 1 | ABC123 | 5 | 20 | VPS | 12 | 4 | example.de | 2000-01-01 | 2010-12-31
  9. | 2 | ABC456 | 15 | 30 | Web-Paket A | 1 | 2 | example.com | 2000-01-01 | 2010-12-31
  10. | 3 | ABC789 | 2 | 10 | Spamschutz | 12 | 5 | example.de | 2000-01-01 | 2010-12-31
  11.  
  12. resultat soll sein:
  13.  
  14. | id | artikel | einzelpreis SUM() | gesamtpreis SUM()| name | intervall | anzahl | domain | start | bezahltbis
  15. | 1 | ABC123 | 15 | 60 | VPS | 12 | 4 | example.de | 2000-01-01 | 2010-12-31
  16. | 2 | ABC456 | 45 | 90 | Web-Paket A | 1 | 2 | example.com | 2000-01-01 | 2010-12-31
  17. | 3 | ABC789 | 10 | 120 | Spamschutz | 12 | 5 | example.de | 2000-01-01 | 2010-12-31
  18.  
  19. bisher bekomme ich mit:
  20.  
  21. SELECT name, SUM(gesamtpreis) as gesamt,SUM(einzelpreis) as einzelpreis FROM bill GROUP BY name
  22.  
  23. | einzelpreis SUM() | gesamtpreis SUM()| name |
  24. | 15 | 60 | VPS |
  25. | 45 | 90 | Web-Paket A |
  26. | 10 | 120 | Spamschutz |
Add Comment
Please, Sign In to add comment