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,
s.count
from bt_components c,
(select p.component_id, count(*) as count
from bt_patches p
where p.project_id = :package_id
group by p.component_id
) s
where s.component_id = c.component_id
order by lower(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, 'YYYY-MM-DD HH24:MI:SS') 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