0

there is a value I get from an SQL query which is stored with the name max_dateCS. This variable needs to be input into another SQL query. I am facing a problem doing that as it gives an error ' list index out of range'.

query2 = """select max(date_hour) from mu_test_table1"""

cur.execute(query2);

conn.commit()

max_dateCS = cur.fetchall();

 Query3= """select count (*) from mu_test_table1
 where date_hour = %s;"""

cur.execute(Query3,(max_dateCS[0]));
conn.commit()
rows = cur.fetchall();
Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284

0 Answers0