之前已经对表数据按begintime字段排序。
select first 100 * from TableName order by begintime;
然后再执行删除操作,将前100条记录删除。
delete first 100 * from alarmhis order by begintime;
但执行错误!该怎样写这个语句?
------解决方案--------------------
由于informix的first选项限制较多,不能用在子查询,也不能用在into temp的select语句中,感觉一个sql写不出来。
用下面的select语句生成一堆delete语句,然后再跑这些delete语句:
select first 100 'delete from TableName where rowid='
------解决方案--------------------
rowid
------解决方案--------------------
';' from TableName order by begintime;
------解决方案--------------------
delete TableName
where 某字段 in (select first 100 * from TableName order by begintime)试试