ORA 00936缺少表达

时间:2014-10-05 16:32:28

标签: sql oracle select syntax-error

我查看了网站,无法找到我的问题的答案,很多很接近,但没有相同。我试图从两个表中选择数据并加入五个。我没有选择信息的三个是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');

1 个答案:

答案 0 :(得分:0)

您的,子句前有一个冗余逗号(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');