postgresql7.1 select * from card_percent where ref_community = :community_id order by percent desc select email as teacher_email from acs_users_all where user_id = :my_user_id select email as student_email from acs_users_all where user_id = :user_id update card set comm_teacher = :comment where ref_community = :community_id and card_id = :card_id insert into card_comment (ref_card, ref_community, date, date_mod, comment) values(:card_id, :community_id, :date, :date, :comment) update card_comment set comment = :comment, date_mod = :date where comment_id = :comment_id delete from card_comment where comment_id = :comment_id update card_note set note_comment = :note_comment, date_mod = :date, grade = :note_grade, is_active= :note_actv where note_id = :note_id update card set comm_teacher = :teacher_comment where ref_community = :community_id and card_id = :card_id