Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Computing on column and where?
> I am having difficulty with the following scenario:
> select a, b, (c + (select otherColumn from otherTable where otherClause)
> from mainTable where 3 >= value order by 3
>
> Basically, I want to perform some calculation on a column of a table,
> use the computed value in the where clause, and return the computed
> value.
Kurt,
I'm not sure if I understand what you are looking for. Does the '3' in your where clause mean the 3rd column? Does your subquery return one row, or multiple rows?
You can try:
SELECT a,b,c + otherColumn
FROM mainTable, (SELECT otherColumn FROM otherTable WHERE
otherClause)
WHERE c+otherColumn >= value
ORDER BY 3;
I'm not sure if it will work, but it's worth a shot.
HTH,
Brian
--