postgresql7.1
select task_id from card_task
where ref_community = :community_id and
task_name = :task_name and
ref_percent = :task_block
select task_id from card_task
where ref_community = :community_id and
task_name = :task_name and
ref_percent = :task_block
and task_id <> :task_id
select t.*,p.percent_id, p.type, p.percent_name
from card_task t
inner join card_percent p on (percent_id = ref_percent)
where t.ref_community = :community_id
order by $order $order_dir
select *
from card_percent p
where p.ref_community = :community_id
order by type asc
select * from card_task
where ref_community = :community_id and
ref_percent = :nav_sel
order by $order $order_dir
insert into card_task
(ref_community, ref_percent, task_name, task_percent, max_grade)
values
(:community_id, :task_block, :task_name, :task_percent, :task_max_grade)
update card_task set
ref_percent = :task_block, task_name = :task_name,
task_percent= :task_percent, max_grade= :task_max_grade
where ref_community = :community_id and
task_id = :task_id
delete from card_task where task_id = :task_id
delete from card_note where ref_task= :task_id
select type as sel_type from card_percent where percent_id = :act_ref_percent