I have the following xml Data in an XML column
<LoyaltyInfo ServerDate="2056-12-12">
<Accounts>
<Acc ID="1" Value="2.750" UpToDate="2014-05-13 18:38:00" />
<Acc ID="2" Value="2.750" UpToDate="2014-05-13 18:38:00" />
<Acc ID="3" Value="141.06" UpToDate="2014-05-22 12:53:00" />
<Acc ID="6" Value="924.42" UpToDate="2014-06-01 16:53:00" />
<Acc ID="7" Value="2895" UpToDate="2014-05-13 18:38:00" />
</Accounts>
</LoyaltyInfo>
I want to write an SQL query to say WHERE Acc ID = x and in the same row Acc Value = y
Ive tried the following but i get errors
SELECT *
FROM TableName
WHERE xmlData.exist('/LoyaltyInfo/Accounts/Acc[@ID="20"]') = 1
AND xmlData.value('/LoyaltyInfo/Accounts/Acc/@Value','integer') = 0
SELECT *
FROM TableName
WHERE xmlData.exist('/LoyaltyInfo/Accounts/Acc[@ID="20"]') = 1
AND xmlData.value('/LoyaltyInfo/Accounts/Acc[@Value]','integer') = 0