Subject | How to use case and where together |
---|---|
Author | Guido Klapperich |
Post date | 2006-06-27T22:57:20Z |
I want to run the following query
select acdate,accompleted,
case
when ((acdate<current_date) and (accompleted=0)) then 1
else 0
end as acoverdue_new
from activities
where acoverdue_new<>0
and get the error that the column acoverdue is unknown.
Is it possible to use the result of a case statement in the where clause
and if yes, how can I do it?
Regards
Guido
select acdate,accompleted,
case
when ((acdate<current_date) and (accompleted=0)) then 1
else 0
end as acoverdue_new
from activities
where acoverdue_new<>0
and get the error that the column acoverdue is unknown.
Is it possible to use the result of a case statement in the where clause
and if yes, how can I do it?
Regards
Guido