我想Select
在 Postgresql 中加入一个 Statement,但我遇到了问题
SELECT
s.sessionid, sp.lang
FROM
sessions s
INNER JOIN
pages sp
ON
sp.sessionid = s.sessionid
INNER JOIN
(
SELECT
max(sessionid)
FROM
sessions
AS
maxSession
)
ON
maxSession = s.sessionid
WHERE
--Where condition
我收到以下错误:错误:FROM 中的子查询必须有别名
LINE 6: (
^
HINT: For example, FROM (SELECT ...) [AS] foo.
如果我添加FROM
FROM
(
SELECT max(sessionid)
FROM sessions
)
AS maxSession
我收到另一个错误
ERROR: syntax error at or near "FROM"
LINE 7: FROM
想法?