Advertisement
VF-

Untitled

VF-
May 23rd, 2023 (edited)
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | Source Code | 0 0
  1. cursor = cnx.cursor()
  2. cursor.execute("""
  3. select
  4. futar.id, futar.nev, sum(osszeg)
  5.  
  6. from futar
  7. left join rendeles on rendeles.futar_id = futar.id
  8.  
  9. group by futar.id, futar.nev
  10.  
  11. order by 3 desc
  12. """)
  13.  
  14. records = cursor.fetchall()
  15.  
  16. print('%3s) %-25s : %10s' % ('SSz', 'Név', 'Összeg'))
  17.  
  18. osszesen = 0
  19. for row in records:
  20.     if row[2] is not None:
  21.         osszesen += float(row[2])
  22.  
  23.     print('%3d) %-25s : %10s' % row)
  24.  
  25. print('     %-25s : %10s' % ('Végösszeg', osszesen))
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement