I have the following query:
select COUNT(persons.id) from persons left join interestlog on persons.id = interestlog.person_id where persons.section = 'TV3' and ( (persons.zip BETWEEN '10000' AND '10100') ) and ( interestlog.interest_id IN (1, 2 ) ) and persons.status = 0 group by persons.id;
And the result is:
+-------------------+
| COUNT(persons.id) |
+-------------------+
| 1 |
| 1 |
| 2 |
| 1 |
| 2 |
| 1 |
| 1 |
+-------------------+
7 rows in set (0.01 sec)
If the person ha interest 1 or 2 it is representet with 1, if the person has both 1 and to it is represented by 2
Thats all fine and correct, but it is not what I want to get. All I want to get is a '7' (the number of rows) Nothing more. Anyone know how to do this?
select COUNT(persons.id) from persons left join interestlog on persons.id = interestlog.person_id where persons.section = 'TV3' and ( (persons.zip BETWEEN '10000' AND '10100') ) and ( interestlog.interest_id IN (1, 2 ) ) and persons.status = 0 group by persons.id;
And the result is:
+-------------------+
| COUNT(persons.id) |
+-------------------+
| 1 |
| 1 |
| 2 |
| 1 |
| 2 |
| 1 |
| 1 |
+-------------------+
7 rows in set (0.01 sec)
If the person ha interest 1 or 2 it is representet with 1, if the person has both 1 and to it is represented by 2
Thats all fine and correct, but it is not what I want to get. All I want to get is a '7' (the number of rows) Nothing more. Anyone know how to do this?