以下代码
postgres=# SELECT title,name,borrower.address WHERE library_branch NATURAL JOIN
book NATURAL JOIN book_loans NATURAL JOIN borrow WHERE library_branch.branchname
='Sharpstown' AND dateOut='12/10/2014';
ERROR: syntax error at or near "NATURAL"
LINE 1: ... title,name,borrower.address WHERE library_branch NATURAL JO...
^
postgres=#
不确定为什么会出错。我以为我正确地做了自然连接。有什么建议吗?
答案 0 :(得分:0)
where
应该有一个from
关键字:
SELECT title, name, borrower.address
FROM library_branch -- There's a WHERE here in the OP
NATURAL JOIN book
NATURAL JOIN book_loans
NATURAL JOIN borrow
WHERE library_branch.branchname = 'Sharpstown' AND
dateOut = '12/10/2014';