假设我有桌子“物品”。
表“items”中有500行。
我想增加一个新的列,' new‘。
第1-100行需要在'new‘列中有'A’,
行101-200需要在'new‘栏中有'B’,
行201-300需要在'new‘列中有'C’。
等等
因此:
是否有mysql查询来执行以下操作:
UPDATE items WHERE rows 1 THROUGH 100 (UPDATE 'A' IN new)发布于 2013-10-17 13:07:49
试试这个:
1-100
UPDATE table
set new = 'A'
where id in
(
Select temp.Id from
(
Select id as Id from table limit 1,100
) as temp
)101-200
UPDATE table
set new = 'B'
where id in
(
Select temp.Id from
(
Select id as Id from table limit 101,100
) as temp
)https://stackoverflow.com/questions/19427551
复制相似问题