The Learner
The Learner

Reputation: 3917

Azure query using the select

I am trying to get a query in azure in which I want to get the entity with the given partition key and row key based on Date.

I am keeping entities Partisionkey, row key, Date, Additional info.

I am looking for a query using tableservies so that , I always get the latest one (using date)

How can I get the query? (I am using node and Azure)

                TableQuery
        .select()
        .from('myusertables')
        .where('PartitionKey eq ?', '545455');

How write the table query?

Upvotes: 0

Views: 401

Answers (1)

Herve Roggero
Herve Roggero

Reputation: 5249

To answer you question, check out this previously answered question: How to select only the records with the highest date in LINQ

However, you may be facing a design issue. Performing the operation you are trying to do will require you to pull all the entities from the underlying Azure Table, which will perform slower over time as entities are added. So you may want to reconsider your design and possibly change the way you use your partitionkey and rowkey. You could also store the latest entities in a separate table, so that only 1 entity is found per table, transforming your scan/filter into a seek operation. Food for thought...

Upvotes: 1

Related Questions