select count(*) from users where screen_name = :screen_name and user_id != :user_id
select count(party_id) from parties where email = lower(:email) and party_id <> :user_id
select attr_value as bio_old
from acs_attribute_values
where object_id = :user_id
and attribute_id =
(select attribute_id
from acs_attributes
where object_type = 'person'
and attribute_name = 'bio')
update parties
set email = :email,
url = :url
where party_id = :user_id
update persons
set first_names = :first_names,
last_name = :last_name
where person_id = :user_id
update users
set screen_name=:screen_name
where user_id = :user_id
insert into acs_attribute_values
(object_id, attribute_id, attr_value)
values
(:user_id, (select attribute_id
from acs_attributes
where object_type = 'person'
and attribute_name = 'bio'), :bio)
update acs_attribute_values
set attr_value = :bio
where object_id = :user_id
and attribute_id =
(select attribute_id
from acs_attributes
where object_type = 'person'
and attribute_name = 'bio')