In the following Python code, the first query works correctly but the second query doesn't return any result. What did I do wrong? The second query is supposed to return a unique number. What is the proper syntax to access that unique result?
# -*- coding: utf-8 -*-
import pymysql #-- Load ODBC connecting tool pypyodbc
conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='', db='orchidsoup')
cur = conn.cursor()
stmt = "SELECT id,genus,species,is_hybrid,author FROM kew_synonym"
res = cur.fetchall()
for row in res:
stmt = "SELECT id FROM kew_accepted where genus='row' and species='row'"
res1 = cur.fetchall()
for row1 in res1:
print(' genus id =',row1)