4 个解决方案
#1
UPDATE ADDRESS SET REMARK='abc' WHERE ADD_ID IN (
SELECT a.ADD_ID FROM
(
select rownumber() over(order by ADD_ID) rownum,c.ADD_ID FROM ADDRESS c
) a where a.rownum <= 5
);
SELECT a.ADD_ID FROM
(
select rownumber() over(order by ADD_ID) rownum,c.ADD_ID FROM ADDRESS c
) a where a.rownum <= 5
);
#2
多谢楼上,如果这个表有多个主键,该怎么写呢?
#3
前100行的某个字段:什么标准
UPDATE tt a
SET a.f1=' '
WHERE a.row_id in
(
SELECT b.row_id FROM tt b fetch first 100 rows only
) rr
or
UPDATE (SELECT * FROM tt FETCH FIRST 100 ROWS ONLY) AS U SET f1='';
UPDATE tt a
SET a.f1=' '
WHERE a.row_id in
(
SELECT b.row_id FROM tt b fetch first 100 rows only
) rr
or
UPDATE (SELECT * FROM tt FETCH FIRST 100 ROWS ONLY) AS U SET f1='';
#4
多谢,楼上的办法很好
#1
UPDATE ADDRESS SET REMARK='abc' WHERE ADD_ID IN (
SELECT a.ADD_ID FROM
(
select rownumber() over(order by ADD_ID) rownum,c.ADD_ID FROM ADDRESS c
) a where a.rownum <= 5
);
SELECT a.ADD_ID FROM
(
select rownumber() over(order by ADD_ID) rownum,c.ADD_ID FROM ADDRESS c
) a where a.rownum <= 5
);
#2
多谢楼上,如果这个表有多个主键,该怎么写呢?
#3
前100行的某个字段:什么标准
UPDATE tt a
SET a.f1=' '
WHERE a.row_id in
(
SELECT b.row_id FROM tt b fetch first 100 rows only
) rr
or
UPDATE (SELECT * FROM tt FETCH FIRST 100 ROWS ONLY) AS U SET f1='';
UPDATE tt a
SET a.f1=' '
WHERE a.row_id in
(
SELECT b.row_id FROM tt b fetch first 100 rows only
) rr
or
UPDATE (SELECT * FROM tt FETCH FIRST 100 ROWS ONLY) AS U SET f1='';
#4
多谢,楼上的办法很好