I am using Amazon Dynamodb but do not have much experience. I have Prices table like this:
Id | InsertionDate | ProductName | ShopName | Price
There can be different values with same shopname and productname, (the price and insertion date might be different). e.g
id1 | 2015-12-14T16:41:42 | Cheese 500g | Shop1 | 2.4
id2 | 2015-12-14T15:41:42 | Cheese 500g | Shop1 | 2.2
id3 | 2015-12-14T12:41:42 | Cheese 500g | Shop2 | 2.1
id4 | 2015-11-14T12:41:42 | Cheese 500g | Shop2 | 2.5
Now I want to query this table so that I get unique values by shops which are newest (i.e the insertion date is earliest) sorted by price. So from above example I want to get this:
id3 | 2015-12-14T12:41:42 | Cheese 500g | Shop2 | 2.1
id1 | 2015-12-14T16:41:42 | Cheese 500g | Shop1 | 2.4
Any ideas how to do this?
you cant do it.
you can query dynamodb only on his indexes (hash-range keys, or global secondary keys.)
in order to query dynamodb, you need at least to query on your 'hash' key, and you will get ordered results on your range key (if you have range key)
http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/Welcome.html
http://www.allthingsdistributed.com/2013/12/dynamodb-global-secondary-indexes.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With