I Have two tables for get impression and click
Product
+----+--------+
| PID| brand |
+----+--------+
| 1 | Ford |
| 2 | Toyota |
| 6 | Holden |
+----+--------+
States
+----+--------+------+--------+------------+
| ID | PID |CLICKS| VIEWS | DATE |
+----+--------+------+--------+------------+
| 1 | 1 | 1 | 0 | 12/12/2015|
| 1 | 1 | 1 | 0 | 12/12/2015|
| 2 | 2 | 1 | 0 | 12/12/2015|
| 3 | 2 | 0 | 1 | 12/12/2015|
| 3 | 1 | 0 | 1 | 12/12/2015|
+----+--------+------+--------+------------+
I need to get some result like this
+--------+------+--------+
| PID |CLICKS| VIEWS |
+--------+------+--------+
| 1 | 2 | 1 |
| 2 | 1 | 0 |
+--------+------+--------+
is it possible? i have tried too many times its coming faults data
group byworksSELECT stats_property.date, property.idproperty, COUNT(stats_property.clicks='1') AS A, COUNT(stats_property.impression='0') AS I FROM property INNER JOIN stats_property ON property.idproperty = stats_property.idproperty group by property.idproperty, stats_property.clicksI Have try this way its not working