我在使用Python编写脚本时遇到困难。 我在MySql中有一个像这样的表:
我想过滤类别类型(例如B)并从上面删除上一行。我在Python中使用mysqldb,并使用选择和其他运算符练习,但我不知道该怎么做。
有人可以帮助我吗?
答案 0 :(得分:0)
delete from Table where id= ( Select id from(select id from Table where CATEGORY = 'B' and SALARY < ( Select SALARY from Table where CATEGORY = 'B' order by SALARY desc LIMIT 1) LIMIT 1) as x );