AND and GROUP BY with Aerospike PHP Client

php
mysql
query

#1

I am currently examining aerospike for replacing my company MySQL database. Currently, in MySQL, we have a table that stores the transaction data, the table looks like this :

+--------+------------+-----------+------------+-----+--------+
| trx_id | trx_date   | client_id | product_id | qty | total  |
+--------+------------+-----------+------------+-----+--------+
|      1 | 2015-01-01 |         1 |          1 | 100 | 100000 |
|      2 | 2015-01-02 |         2 |          2 | 200 | 200000 |
|      3 | 2015-01-03 |         3 |          3 | 300 | 300000 |
+--------+------------+-----------+------------+-----+--------+

For reporting, we usually do something like :

SELECT MONTH(trx_date), SUM(qty), SUM(total) FROM transaction WHERE client_id = 1 AND product_id = 1 GROUP BY MONTH(trx_date)

to get the monthly transaction data for a client.

I’ve read the documentation for the Aerospike PHP client and I don’t seem to find anything similar to AND, GROUP BY, or MONTH.

So, in Aerospike PHP client, what is the recommended way to achieve something like that?

Thanks.


#2

I answered your parallel question on Stack Overflow. The gist is that this is given as an example for the PHP client’s aggregate() method. Let me know if it’s unclear.