Nov-23-2022, 03:03 PM
(This post was last modified: Nov-23-2022, 03:04 PM by Krissstian.)
Hi,
How can I determine number of a value occur in a column from an sql db?
7
7
7
7
where 7 is the total number of rows and it occur 4 times, but I need number 4 as result.
Thanks
How can I determine number of a value occur in a column from an sql db?
con = pymysql.connect(host='localhost', user='root', password='*', database='prices') cur = con.cursor() cur.execute('select Var78 from prices ') rows = cur.fetchall() if rows != 0: self.totalrecord.set(len(rows)) table.delete(*table.get_children()) for row in rows: if row[78] == 'A': table.insert("", END, values=row, tags='Albastru') a = len(rows) print(a)It result:
7
7
7
7
where 7 is the total number of rows and it occur 4 times, but I need number 4 as result.
Thanks