I’d like to be able to set add a field that answers the question “For a value in this record, does that value meet some condition in another table?”. I thought I’d try a case-when with an exists, but Teradata (my dbms) does not like it. Any recommendations?
select foo,
(case when exists (select x.foo
from somedb x
where x.bar > 0)
then '1' else '0' end) as MyFlag
from mydb
I couldn’t come up with a solution that was easy to read (key when you’re dim-witted as I am), so I did a union into a temporary table:
But now I don’t feel like a tough guy 🙁