Forum OpenACS Q&A: Response to ERROR in mailing-list/index .tcl

Collapse
Posted by Dan Wickstrom on
You've found an unported query. The following query (untested) should work:
            "select c.category, c.category_id, 
                    case when ui.category_id is NULL then NULL::char else 't'::char end as selected_p
               from categories c, users_interests ui
              where c.enabled_p = 't' 
                and ui.user_id = $user_id
                and c.category_id = ui.category_id
    union all
             select c.category, c.category_id, 
                    NULL::char as selected_p
               from categories c
              where c.enabled_p = 't' 
                and ui.user_id = $user_id
                and not exists (select 1 from user_interests 
                                 where category_id = c.category_id 
                                   and user_id = $user_id)"