Question

I am having two tables: INFORGAIN200 (WORD, IG) and TF (FILEID, WORD, T_FREQ). In the INFOGAIN200 table I have only 200 words, in the TF there are a lot more. Now I want to inner join INFOGAIN200 to TF based on the descendent ranking of T_FREQ in TF. Below is my code.

SELECT B.FILEID, B.WORD, TF.T_FREQ
FROM (SELECT * FROM TF, ORDER BY T_FREQ DESC) INNER JOIN INFOGAIN200 B
ON B.WORD=TF.WORD;

Here is the error code: ORA-00903: invalid table name 00903. 00000 - "invalid table name". The error points to ORDER BY. Please suggest how to walk around this. Thanks.

Was it helpful?

Solution

SELECT B.FILEID, B.WORD, TF.T_FREQ
FROM TF INNER JOIN INFOGAIN200 B
ON B.WORD=TF.WORD
ORDER BY TF.T_FREQ DESC;

Anyways FYI, you cannot use ORDER BY clause inside derived tables. You will get error

The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top