update events_registrations set comments = :comments where reg_id = :reg_id select 1 from events_registrations er, events_activities ea, acs_events ae where er.reg_id = :reg_id and er.event_id = ae.event_id and ae.activity_id = ea.activity_id and ea.package_id = :package_id update events_registrations set reg_state = 'waiting' where reg_id = :reg_id update events_registrations set reg_state = 'approved' where reg_id = :reg_id update events_registrations set reg_state = 'canceled' where reg_id = :reg_id update events_registrations set reg_state = :reg_state, user_id = :party_id where reg_id = :reg_id insert into events_attr_category_map (attribute_id, category_id) values (:attribute_id, :category_id) select aa.attribute_id, aa.attribute_name as name, aa.sort_order, aa.datatype, aa.pretty_name, aa.pretty_plural, eac.category_name, eac.category_id from acs_attributes aa, events_attr_categories eac, events_attr_category_map eacm where aa.attribute_id = :attribute_id and aa.attribute_id = eacm.attribute_id and eacm.category_id = eac.category_id f update acs_attributes set attribute_name = :attribute_name, pretty_name = :pretty_name, pretty_plural = :pretty_plural, datatype = :datatype where attribute_id = :attribute_id update events_attr_category_map set category_id = :category_id where attribute_id = :attribute_id delete from events_attr_category_map where attribute_id = :attribute_id insert into events_event_attr_map (event_id, attribute_id) values (:event_id, :attribute_id) insert into events_def_actvty_attr_map (activity_id, attribute_id) values (:activity_id, :attribute_id) delete from events_event_attr_map where attribute_id = :attribute_id delete from events_def_actvty_attr_map where attribute_id = :attribute_id select max(aa.sort_order) as sort_order_max from acs_attributes aa, events_attr_category_map eacm where category_id = :category_id and aa.attribute_id = eacm.attribute_id