# Related Sites > SQL Course >  HAVING Excersise #3 question/problem/bug?

## awesomepeter

I just got a question, since you say in the #3:




> How many orders did each customer make? Use the items_ordered table. Select the customerid, number of orders they made, and the sum of their orders if they purchased more than 1 item.
> Exercise #3


and the answer you give is:



```
SELECT customerid, count(customerid), sum(price)
FROM items_ordered
GROUP BY customerid
HAVING count(customerid) > 1;
```

but shouldn't it be:



```
SELECT customerid, count(customerid), sum(price)
FROM items_ordered
GROUP BY customerid
HAVING count(quantity) > 1;
```

since you say if they purchased more then 1 item, but you count the number of times they ordered not the number of items they bought, don't know if i'm wrong or i found some liddle error  :Smilie:

----------


## FutureSQLPro

I agree with u.
experts, pl help

----------


## skhanal

It does not matter, the count is counting the rows in the grouped rows, it counts 1 for each row, it is not the sum of quantity. So this is good too.

SELECT customerid, count(customerid), sum(price)
FROM items_ordered
GROUP BY customerid
HAVING count(*) > 1;

----------


## FutureSQLPro

Thanks skhanal.

----------

