我要做的是创建一个连接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;
答案 0 :(得分:0)
您的WHERE
条款需要在ORDER BY
之前。