here is the simple query, that I am using (in real world I am using active record and its big query to show you, so please consider this one for now)

```
SELECT *,(id/* another big query*/) as distance FROM members having distance<=8

```

if I run the above query then its return perfect results total 5
but I run this query

```
SELECT count(*),(id/* another big query*/) as distance FROM members having distance<=8

```

and count always count all the rows of my table,i just want apply having conditions with getting counts of rows that returns in above query.

I can't remove having clause but I can change count to something else.