the query result and expected output below.
+------+----------+
| YEAR | MAX_TEMP |
+------+----------+
| 1990 | 603 |
| 1991 | 605 |
+------+----------+
This is my code. In the output in just getting no of records (i.e 2). How can i make it to show the full table?
import MySQLdb
conn = MySQLdb.connect("localhost","root","root","vkp")
cursor = conn.cursor()
print ("Opened database successfully");
def select():
#database_conn()
print ("inside select")
a = cursor.execute("SELECT year(dt) AS YEAR, max(air_temp) AS MAX_TEMP from TEMP_DATA WHERE air_temp != 9999 AND (quality_at = '0' || quality_at = '1' || quality_at = '4' || quality_at = '5' || quality_at = '9') GROUP BY year(dt); SELECT year(dt) AS YEAR, max(air_temp) AS MAX_TEMP from MAX_TEMP9293 WHERE air_temp != 9999 AND (quality_at = '0' || quality_at = '1' || quality_at = '4' || quality_at = '5' || quality_at = '9') GROUP BY year(dt)")
return a
conn.commit()
conn.close
a = select()
print (a)
returnlooks like it's in the wrong spot here.