SQLPlus缺少关键字WHERE子句

时间:2015-11-30 02:24:26

标签: sql oracle join where

我已经通过此查询达成了智慧。非常感谢答案。

SELECT invoice_num, item_id, salesperson_num, ship_num
FROM invoices_jr_je 
    INNER JOIN items_sold_jr_je 
    INNER JOIN salespersons_jr_je
    INNER JOIN ship_tos_jr_je
WHERE invoice_date LIKE '%15'
GROUP BY invoice_num;

SQLPlus提供以下错误:

WHERE invoice_date LIKE '%15'
*
ERROR at line 6:
ORA-00905: missing keyword

1 个答案:

答案 0 :(得分:0)

我忘了使用USING语法,因此:

SELECT invoice_num, item_id, salesperson_num, ship_num
FROM invoices_jr_je    
    INNER JOIN items_sold_jr_je USING (invoice_num)
    INNER JOIN salespersons_jr_je USING (salesperson_num)
    INNER JOIN ship_tos_jr_je USING (ship_num)
WHERE invoice_date LIKE '%15'
ORDER BY invoice_num;