What the best way to make only one call to the DB in this case :
query="""SELECT measure FROM data
WHERE id =%s AND pId = %s AND data_type ='total'
ORDER BY createdAt DESC LIMIT 1;"""
lines = self.cursor.execute(query,(id,pId))
query="""SELECT measure FROM data
WHERE id =%s AND pId = %s AND data_type ='tot_m'
ORDER BY createdAt DESC LIMIT 1;"""
lines = self.cursor.execute(query,(id,pId))
Works fine but are made 2 queries to the table. What best way to do the in one query ? Thx in advance and sorry for my english...