raju raju - 3 months ago 29
SQL Question

ORA-00905: missing keyword in oracle query

I have 2 tables category and coupon_category in my oracle database

I am making query

select coupon_category.coupon from coupon_category JOIN category;


which gives me error

SQL> select coupon_category.coupon from coupon_category INNER JOIN category;
select coupon_category.coupon from coupon_category INNER JOIN category
*
ERROR at line 1:
ORA-00905: missing keyword


What is the mistake I am making?

Answer

The issue seems to be a misunderstanding of join syntax. Your current code is combining the old and new syntax for joining two tables. The proper join can be accomplished by using either correctly (with the ON syntax preferred).

select coupon_category.coupon from coupon_category INNER JOIN category ON coupon_category.coupon=category.id;
--OR
select coupon_category.coupon from coupon_category, category where coupon_category.coupon=category.id;