Can I put a subquery in the where clause, on the left side on the operator?
This is a multi-row query.
Like this,
select a.col1, a.col2, b.col1, b.col2,
my_function(a.date1, b.date2) AS GROSSDAYS
from table1 a
where ( select ( a.date1 - b.date2 ) as range
from table1 a
join table2 b
on a.col3 = b.col3
where rownum =1
)
in ( 1,2,3)
and a.col1 = b.col2
I need to use a subquery because the column I need does not exist in the table, and I cannot make any changed to the table structure.
Is what I'm doing possible?
The subquery is the same as the function I have in the Select clause.