1

我要做的是创建一个连接 2 个表、人员和文档的视图。每个人会有很多文件,但我只想要那个人最近发布的文件。所以我想我加入了 2 个工作正常的表,然后我尝试从文档中订购发布日期以获得最新的,然后获得该行的顶部。对我来说这是有道理的,但我收到以下错误

 that the SQL code is not complete

我的代码如下:

CREATE VIEW DisplayPersons
  AS
    SELECT 
      P.PERSON_ID AS "Person_ID",
      P.SURNAME AS "Surname",
      ...
      FROM PERSONS P
    LEFT JOIN
      DOCUMENTS D ON D.RECEIVED_BY = P.SURNAME||', '||P.INITIALS
      ORDER BY D.ISSUED_DATE DESC 
      WHERE ROWNUM <= 1;
4

1 回答 1

0

您的WHERE子句需要放在前面ORDER BY

于 2013-01-31T16:40:19.023 回答