Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cursor = cnx.cursor()
- cursor.execute("""
- select
- futar.id, futar.nev, sum(osszeg)
- from futar
- left join rendeles on rendeles.futar_id = futar.id
- group by futar.id, futar.nev
- order by 3 desc
- """)
- records = cursor.fetchall()
- print('%3s) %-25s : %10s' % ('SSz', 'Név', 'Összeg'))
- osszesen = 0
- for row in records:
- if row[2] is not None:
- osszesen += float(row[2])
- print('%3d) %-25s : %10s' % row)
- print(' %-25s : %10s' % ('Végösszeg', osszesen))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement