postgresql7.1
insert into card_percent
(ref_community, type, percent_name, percent, rvalor)
values
(:community_id, :block_type, :block_name, :block_percent, :block_rvalor)
select * from card_percent where ref_community = :community_id
order by $order $order_dir
select * from card_percent where percent_id = :block_id
update card_percent
set percent_name= :block_name, percent= :block_percent,
type= :block_type, rvalor= :block_rvalor
where percent_id= :block_id
select task_id from card_task
where ref_percent = :block_id
delete from card_note where ref_task= :del_i
delete from card_task where ref_percent= :block_id
delete from card_percent where percent_id= :block_id
select percent_id from card_percent
where ref_community = :community_id and percent_name = :block_name
select percent_id from card_percent
where ref_community = :community_id and
percent_name = :block_name
and percent_id <> :block_id
select sum (percent) as total_p from card_percent
where ref_community = :community_id
update card_task
set task_percent= :new_percent
where ref_percent= :block_id