如何使用梅赛德斯的一个查询设置相同的“优先级”。
+---------------------+-------------+-------------+ | cars | place | priority | +---------------------+-------------+-------------+ |Aston Martin |Moscov |1 | |Mercedes Benz |Paris |3 | |Aston Martin |Moscov |1 | |Ferrari Testarossa |New York |2 | |Ferrari Testarossa |Moscov |2 | |Subaru impreza |Paris |4 | |Aston Martin |Paris |1 | |Aston Martin |New York |1 | |Mercedes Benz |Moscov |3 | |Subaru impreza |New York |4 | +---------------------+-------------+-------------+
答案 0 :(得分:0)
可能类似
Update table_name
set priority = case when cars ='Mercedes Benz' then 1
when cars ='Aston martin' then 2
when cars ='Subaru Impreza' then 3 end;
您可以在单个查询中更新所有汽车优先级。
答案 1 :(得分:0)
VALUE
-----
in stock