Question: I have a SQL query that performs an INNER JOIN on two tables having >50M rows each. I wish to reduce the time it takes to search through the join by reducing the rows that are joined based on a column present on one of the tables. 

Say I have table1 with columns A,B,C and table2 with columns A,D,E. I wish to join based on column A but only those rows that have value 'e' for column E of table 2.

My SQL query :

```
SELECT one.B, two.D
FROM table1 one
INNER JOIN table2 two WHERE two.E IN ('e')
ON one.A = two.A
WHERE one.B > 10
AND two.D IN ('...')

```

It gives the error :

```
ORA-00905: missing keyword

```

Where am I going wrong? How do I achieve the intended result?

Answer: 
```
SELECT one.B, two.D
FROM table1 one
INNER JOIN table2 two -- WHERE two.E IN ('e')  --> shouldn't use where here
ON one.A = two.A and two.E = 'e'
WHERE one.B > 10
AND two.D IN ('...')

```

Comments included in the code.
As vkp pointed out, the WHERE is improperly used. Instead you could also make a subquery to include that where statement. So that:

```
INNER JOIN table2 two WHERE two.E IN ('e')

```

becomes

```
INNER JOIN (select * from table2 WHERE E IN ('e')) two

```