Code: Select all
mysql> select pi.rrd_step, pi.rrd_next_step, data_source_profile_id, count(*)
-> from poller_item as pi
-> inner join data_template_data AS dtd
-> on dtd.local_data_id=pi.local_data_id
-> group by pi.rrd_step, pi.rrd_next_step, data_source_profile_id;
+----------+---------------+------------------------+----------+
| rrd_step | rrd_next_step | data_source_profile_id | count(*) |
+----------+---------------+------------------------+----------+
| 300 | 120 | 9 | 320 |
| 300 | 180 | 9 | 318 |
| 300 | 240 | 9 | 316 |
| 300 | 0 | 9 | 320 |
| 300 | 60 | 9 | 318 |
| 60 | 0 | 3 | 30 |
| 60 | 0 | 10 | 2 |
+----------+---------------+------------------------+----------+
7 rows in set (0.01 sec)