import pymysql conn=pymysql.connect(host='218.93.191.20',port=3306,user='read_only_jiansun',password='^9B%@iQJESZrR!',db='jiansunblueprint',charset='utf8mb4',autocommit=True) cur=conn.cursor() cur.execute("select id,picture,pictureId,skucodes,withInstructions,withVideo from missiontask where withVideo='1' and isDelete='0' order by createdTime desc limit 5") rows=cur.fetchall() print('tasks',len(rows)) for r in rows: print('task',r[0],'picid',r[2],'withVideo',r[5]) cur.execute('select id,hid,url,orderNum,videoId from missiontask_video where hid=%s order by orderNum asc limit 5',(r[0],)) v=cur.fetchall(); print(' video_rows',len(v)); for x in v: print(' ',x) cur.close(); conn.close()