Need help in with subquery in FROM Clause

Database

Need help in with subquery in FROM Clause

I have a query which looks like this

Select col1, col2, DueDate from tab1 t1,
(
select max(col1) as DueDate from tab1 t2 where t2.id = t1.id and t2.col2 <> 1 and t2.col2 <> 7
) DerivedTab

But when i run this query i get an error saying that "object t1 doesnt exist".

Could any one help me whats wrong with this query.. and how can that be rectified

Appreciate any help on this
1 REPLY

Re: Need help in with subquery in FROM Clause

U r refering t1 in the sub query which u didnt declare..
Try using corelated sub query or this can be done by using a self join.