We are trying to search a dynamodb, and need to get count of objects within a grouping, how can this be done?
I have tried this, but when adding the second number, this doesn't work:
$search = array(
    'TableName'     => 'dev_adsite_rating',
    'Select'        => 'COUNT',
    'KeyConditions' => array(
        'ad_id' => array(
            'ComparisonOperator' => 'EQ',
            'AttributeValueList' => array(
                array('N' => 1039722, 'N' => 1480)
            )
        )
    )
);
$response = $client->query($search);
The sql version would look something like this:
select ad_id, count(*) 
from dev_adsite_rating
where ad_id in(1039722, 1480)
group by ad_id;
So, is there a way for us to achieve this? I can not find anything on it.
Trying to perform a query like this on DynamoDB is slightly trickier than in an SQL world. To perform something like this, you'll need to consider a few things
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