title: Combining Queries into one and iterate for multiple unique identifiers
body: <p>I am trying to see if there is a way to combine CTE query and the Update query into one query. Also, I need to iterate the following query for multiple "AttributeId", when I try to put multiple AttributeID's in "in clause" it does not give me the result I want. Is there a better way of writing this query and instead of repeating the same query over and over again for different attribute ID - is the a way to write it like we write For Each loop? Thank you very much for your help!
  <a href="https://i.stack.imgur.com/c0kKr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c0kKr.png" alt="enter image description here"></a></p>