Select im_screen_name from jb_screens where user_id = :user_id and service = 'jabber' Select (im_screen_name) as friend_screen_name from jb_screens where screen_id = :screen_id delete from jb_friends where user_id = :user_id and friend_screen_id = :screen_id update jb_screens SET refcount = refcount - 1 where screen_id = :screen_id