postgresql7.1 and archive_date <= current_timestamp and release_date <= current_timestamp and (archive_date > current_timestamp or archive_date is null) select count(*) from press_items_approved where archive_date <= current_timestamp