postgresql7.1
select forums_messages.*,
person__name(forums_messages.user_id) as user_name,
to_char(forums_messages.posting_date, 'Mon DD YYYY HH24:MI:SS') as posting_date,
100 as the_score
from forums_messages,
forums_forums
where forums_messages.forum_id = forums_forums.forum_id
and forums_forums.package_id = :package_id
and forums_messages.state = 'approved'
and ( forums_messages.subject like ('%' || :search_text || '%')
or forums_messages.content like ('%' || :search_text || '%')
or person__name(forums_messages.user_id) like ('%' || :search_text || '%')
)
order by the_score desc,
forums_messages.posting_date desc
select forums_messages.*,
person__name(forums_messages.user_id) as user_name,
to_char(forums_messages.posting_date, 'Mon DD YYYY HH24:MI:SS') as posting_date,
100 as the_score
from forums_messages,
forums_forums
where forums_forums.forum_id = :forum_id
and forums_forums.package_id = :package_id
and forums_messages.forum_id = forums_forums.forum_id
and forums_messages.state = 'approved'
and ( forums_messages.subject like ('%' || :search_text || '%')
or forums_messages.content like ('%' || :search_text || '%')
or person__name(forums_messages.user_id) like ('%' || :search_text || '%')
)
order by the_score desc,
forums_messages.posting_date desc