Forum OpenACS Q&A: Response to Outer join Query for Users_files: Help

Collapse
Posted by Todd Gillespie on
I think this way is simplest:

select u.user_id,u.last_name,
  case when exists (select 1 from users_files uf where uf.owner_id = u.user_id) then '*'
   else null
  end as file_owner_flag
from users

If you think about it, I'm not sure that an outer join is appropriate here. You aren't trying to retrieve data in the users_files table, but rather use it to answer a boolean question on rows in users.

HTH