postgresql7.1
select object_id as pid from acs_objects, apm_packages as apmp
where context_id = (
select package_id from dotlrn_communities_all
where community_id = :community_id)
and package_key = 'cards' and object_id = apmp.package_id;
select attr_value as value from apm_parameter_values
where parameter_id = :param_id and
package_id = :pid
select a.user_id as user_id
from acs_users_all a, dotlrn_member_rels_approved r
where r.community_id = :community_id and
r.user_id = a.user_id and
(role='student' or role='member')
order by user_id asc
select parent_community_id
from dotlrn_communities_all
where community_id = :community_id
select pretty_name
from dotlrn_communities_all
where community_id = :community_id
select a.user_id as user_id
from acs_users_all a, dotlrn_member_rels_approved r
where r.community_id = :community_id and
r.user_id = a.user_id and
(role='student' or role='member') and
a.user_id not in
(select ref_user from card where ref_community = :community_id)
select card_id from card where ref_community = :community_id
select block_id from card_percent p
where s.ref_community = :community_id
order by percent desc
select task_id from card_task s
inner join card_percent on (percent_id = ref_percent)
where s.ref_community = :community_id
order by task_id asc
select type from card_percent
where percent_id = :task_block
insert into card (ref_community, ref_user)
values (:community_id, :user_id)
select card_id from card
where ref_community = :community_id and ref_user = :user_id
insert into card_note (ref_card,ref_task,grade,ref_community)
values (:card_id, :task_id, 0.00, :community_id)
select last_name, first_names
from acs_users_all
where user_id = :user_id
select c.item_id
from acs_rels a, cr_items c
where a.object_id_two = c.item_id and
a.object_id_one = :user_id and
a.rel_type = 'user_portrait_rel'
select c.item_id
from acs_rels a, cr_items c
where a.object_id_two = c.item_id and
a.object_id_one = :user_id and
a.rel_type = 'user_portrait_rel'
update apm_parameter_values
set attr_value = :value
where parameter_id = :param_id and
package_id = :pid