我浏览了该站点,但找不到我的问题的答案,很多答案很接近,但不尽相同。我正在尝试从两个表中选择数据并加入五个表。我没有为其选择信息的三个是Publisher,order_items和book_order。它们只是ERD中符合要求的表格。我一直在收到ORA 00936:FROM行上缺少表达式。但是我不知道是什么原因造成的。所有表均准确表示,唯一不同的是SELECT行中的TO_CHAR语句。我认为可能是问题所在。
SELECT book_customer.firstname, book_customer.lastname,
TO_CHAR(book_order.orderdate,'MM/DD/YYYY') AS "Order Date",
FROM book_customer, book_order, order_items, books, publisher
WHERE (book_customer.customerid = book_order.customerid)
AND (book_order.orderid = order_items.orderid)
AND (order_items.bookid = books.bookid)
AND (books.pubid = publisher.pubid)
AND (publisher.publishername = 'printing with us');
最佳答案
在,
子句之前,您有一个多余的逗号(from
):
SELECT book_customer.firstname, book_customer.lastname,
TO_CHAR(book_order.orderdate,'MM/DD/YYYY') AS "Order Date" -- Comma removed here
FROM book_customer, book_order, order_items, books, publisher
WHERE (book_customer.customerid = book_order.customerid)
AND (book_order.orderid = order_items.orderid)
AND (order_items.bookid = books.bookid)
AND (books.pubid = publisher.pubid)
AND (publisher.publishername = 'printing with us');
关于sql - ORA 00936缺少表达,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26204731/