postgresql7.1
select fm.message_id,
fm.subject,
person__name(fm.user_id) as user_name,
$replies as n_messages,
to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi
from forums_messages_approved fm
where fm.forum_id = :forum_id
and fm.parent_id is null
[template::list::orderby_clause -orderby -name messages]
select fm.message_id,
fm.subject,
fm.last_poster as user_id,
person__name(fm.last_poster) as user_name,
to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi,
fm.state,
$replies as n_messages,
to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi,
case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p
from forums_messages_approved fm
where fm.forum_id = :forum_id
and fm.parent_id is null
[template::list::page_where_clause -and -name messages -key fm.message_id]
[template::list::orderby_clause -orderby -name messages]
lower(person__name(fm.last_poster)) desc
lower(person__name(fm.last_poster)) asc