select case when count(*) = 0 then 0 else 1 end from site_nodes where name = :name and parent_id = :parent_id and node_id <> :new_node_id select case when count(*) = 0 then 0 else 1 end from site_nodes where node_id = :new_node_id