Исправь мой код: if text == "🗂Хисобот олиш ☑️": cursor.execute("select a.regcom_types,…
- User
Исправь мой код: if text == "🗂Хисобот олиш ☑️": cursor.execute("select a.regcom_types, concat(pr,' * дона /* ',ot) from (SELECT rc.regcom_types,count(rc.regcom_types) pr FROM reg_computer rc left join history_computer hc on rc.regcom_id=hc.reg_com_id where hc.hist_status_working='Принимать' group by regcom_types) a RIGHT join (SELECT rc.regcom_types,count(rc.regcom_types) ot FROM reg_computer rc left join history_computer hc on rc.regcom_id=hc.reg_com_id where hc.hist_status_working='Отдавать' group by regcom_types) b on a.regcom_types=b.regcom_types") data = cursor.fetchall() for i in data: if (i[0]=="MFU"): device_type = "ЖАМИ ОРГ.ТЕХНИКАЛАР СОНИ:""\n\n""🖨 МФУ" elif (i[0] == "NOTEBOOK"): device_type = "💻 НОУТБУК" elif (i[0] == "PC"): device_type = "🖥 ПК" elif (i[0] == "PLOTTER"): device_type = "📠 ПЛОТТЕР" elif (i[0] == "PRINTER"):device_type = "🖨 ПРИНТЕР" elif (i[0] == "PROJECTOR"): device_type = "📽 ПРОЕКТОР" elif (i[0] == "SCANER"): device_type = "📇 СКАНЕР" elif (i[0] == "MONITOR"): device_type = "📺 МОНИТОР" elif (i[0] == "TV"):device_type = "📺 ТВ" d = d + device_type +": " + i[1] + "\n" device_type = ""
bot.send_message(message.from_user.id, d, parse_mode='Markdown') - Assistant
Вот исправленный код:
if text == "🗂Хисобот олиш ☑️": cursor.execute("select a.regcom_types, concat(pr,' * дона /* ',ot) from (SELECT rc.regcom_types,count(rc.regcom_types) pr FROM reg_computer rc left join history_computer hc on rc.regcom_id=hc.reg_com_id where hc.hist_status_working='Принимать' group by regcom_types) a RIGHT join (SELECT rc.regcom_types,count(rc.regcom_types) ot FROM reg_computer rc left join history_computer hc on rc.regcom_id=hc.reg_com_id where hc.hist_status_working='Отдавать' group by regcom_types) b on a.regcom_types=b.regcom_types") data = cursor.fetchall() d = "" for i in data: if i[0]=="MFU": device_type = "*ЖАМИ ОРГ.ТЕХНИКАЛАР СОНИ:*""\n\n""*🖨 МФУ*" elif i[0] == "NOTEBOOK": device_type = "*💻 НОУТБУК*" elif i[0] == "PC": device_type = "*🖥 ПК*" elif i[0] == "PLOTTER": device_type = "*📠 ПЛОТТЕР*" elif i[0] == "PRINTER": device_type = "*🖨 ПРИНТЕР*" elif i[0] == "PROJECTOR": device_type = "*📽 ПРОЕКТОР*" elif i[0] == "SCANER": device_type = "*📇 СКАНЕР*" elif i[0] == "MONITOR": device_type = "*📺 МОНИТОР*" elif i[0] == "TV": device_type = "*📺 ТВ*" d = d + device_type +": " + i[1] + "\n" device_type = "" bot.send_message(message.from_user.id, d, parse_mode='Markdown')