我写了下面的python代码,但是我有一个问题。我需要为MySQL设置一个条件‘如果列高度中的两个变量相等,则显示更多宽度一个上部’:

import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="",
database="data"
)
mycursor = mydb.cursor()
sql = "SELECT * FROM data ORDER BY Height"
mycursor.execute(sql)
myresult = mycursor.fetchall()
for x in myresult:
print(x[0],x[1],x[2],'\n')```发布于 2020-07-19 20:31:24
为order by添加第二个条件
SELECT * FROM data ORDER BY Height, width 或
SELECT * FROM data ORDER BY Height, width DESC 对于相同高度的宽度降序
https://stackoverflow.com/questions/62980290
复制相似问题