Reputation: 743
I'm trying to build a pretty simple RSS aggregator using Azure Table Storage, Azure Website and Azure WebJobs.
Lets say my table storage looks like this,
PartitionKey RowKey
A ----------------- 1
A ----------------- 5
A ----------------- 6
B ----------------- 2
B ----------------- 4
B ----------------- 7
I'm using this method, http://blog.liamcavanagh.com/2011/11/how-to-sort-azure-table-store-results-chronologically/ to set RowKeys.
And the PartitionKey is an unique identifier of each feed.
Now, if I would like to have the three newest items (A1, B2 and B3). Is it possible to do a query on two PartiotionKeys and then order by the RowKey?
Upvotes: 2
Views: 6000
Reputation: 5513
Put the RowKey in reverse. Instead of 1, 5, 6, etc... start with an impossibly high value (maxint) and then subtract from it. For your case, to keep from having to juggle an arbitrary ID value, perhaps instead use datatime "ticks" as the seed value.
Here's a fairly old example I did of accomplishing something that seems similar to what you're after: http://brentdacodemonkey.wordpress.com/2011/07/08/kicking-off-a-year-of-azureweek-1/
Upvotes: 1