postgresql7.1
select case when count(*) = 0 then 0 else 1 end
from news_items_approved
where publish_date < current_timestamp
and archive_date < current_timestamp
and package_id = :package_id
select case when count(*) = 0 then 0 else 1 end
from news_items_approved
where publish_date < current_timestamp
and (archive_date is null
or archive_date > current_timestamp)
and package_id = :package_id
publish_date < current_timestamp
and (archive_date is null or archive_date > current_timestamp)
publish_date < current_timestamp
and archive_date < current_timestamp