azureazure-table-storageazure-tablequery

Azure Table Storage: Is it possible to use a query condition that compares to result of adding two column values?


I have an Azure Storage table where I store the results of encounters with flashcards. It has columns like:

UserID CardID ConsecutiveCorrect TotalCorrect TotalIncorrect

Sadly, I did not think to add a column for TotalEncounters. I'm trying to think of a way to query for cards that have been seen N times. This would be easy if I could just say WHERE TotalCorrect + TotalIncorrect = N, but I don't see anywhere in the API where it's possible to do this.

Am I just missing something awesome? Or is this actually impossible in Azure Table Storage?


Solution

  • Am I just missing something awesome? Or is this actually impossible in Azure Table Storage?

    You're not missing out. Unfortunately this kind of thing is not possible with Azure Table Storage. You will have to apply this kind of logic in your application code only by fetching all entities.

    My recommendation would be to add another attribute in the table for TotalEncounters and keep on updating its value whenever TotalCorrect and/or TotalIncorrect attributes are changed. That way you don't have to apply this logic in your application code.