我想将一个列INT(10)添加到TABLE中,此列显示为1到x,具体取决于列a到7
Array (
[0] => stdClass Object
(
[brand_id] => 1
[cat_id] => 1
[qty] => 400
)
[1] => stdClass Object
(
[brand_id] => 4
[cat_id] => 35
[qty] => 300
[product_id] => 322
)
)
数字应为= ORDER BY title ASC
谢谢
答案 0 :(得分:1)
得到它
SET @sort := 0;
UPDATE mytable
SET `ordering` = @sort := @sort + 1 ORDER BY title;