bt_patches.status = :status
bt_patches.apply_to_version = :apply_to_version
bt_patches.apply_to_version is null
select c.component_name,
c.component_id,
(select count(*)
from bt_patches p
where p.project_id = :package_id
and p.component_id = c.component_id
) as count
from bt_components c
where exists (select 1 from bt_patches p2
where p2.component_id = c.component_id)
order by c.component_name
bt_patches.component_id = :component_id
select bt_patches.patch_number,
bt_patches.summary,
bt_patches.status,
to_char(acs_objects.creation_date, 'fmMM/DDfm/YYYY') as creation_date_pretty,
bt_components.component_name,
(select atv.version_name
from bt_versions atv
where atv.version_id = bt_patches.apply_to_version
) as apply_to_version_name
from bt_patches,
bt_components,
acs_objects
where bt_patches.patch_id = acs_objects.object_id
and bt_patches.project_id = :package_id
and bt_components.component_id = bt_patches.component_id
[list::filter_where_clauses -and -name "patches"]
order by acs_objects.creation_date desc