postgresql7.2 SELECT le.entry_id as id, acs_permission.permission_p(le.entry_id, :current_user_id, 'delete') as delete_p, acs_permission.permission_p(le.entry_id, :current_user_id, 'write') as edit_p, le.time_stamp, to_char(le.time_stamp, 'fmDyfm fmMMfm-fmDDfm-YYYY') as time_stamp_pretty, to_char(le.time_stamp, 'IW-YYYY') as time_stamp_week, le.value, le.description, task.title as project_name, submitter.person_id as user_id, submitter.first_names || ' ' || submitter.last_name as user_name FROM logger_entries le , (SELECT r.title, m.logger_entry FROM cr_items i, cr_revisions r, pm_task_logger_proj_map m WHERE r.item_id = m.task_item_id and i.live_revision = r.revision_id) task, logger_projects lp, acs_objects ao, persons submitter WHERE le.entry_id = task.logger_entry (+) and le.project_id = lp.project_id and ao.object_id = le.entry_id and ao.creation_user = submitter.person_id [ad_decode $where_clauses "" "" "and [join $where_clauses "\n and "]"] ORDER BY $order_by