oracl 和db2 常用语法比较: 1、取前N条记录 Oracle:Select * from TableName where rownum <= N; DB2:Select * from TableName fetch first N rows only; 2、取得系统日期 Oracle:Select sysdate from dual; DB2:Select current timestamp from sysibm.sysdummy1; 3、空值转换 Oracle:Select
比如有文章表 Article(Id,Category,InsertDate),现在要用SQL找出每种类型中时间最新的前N个数据组成的集合,一段不错的代码,留存备用
SELECT A1.*
FROM Article AS A1
INNER JOIN (SELECT A.Category,A.InsertDate
FROM Article AS A
LEFT JOIN Article AS B
ON A.Category =