count distinctive records

  • Thread starter Thread starter Kristof
  • Start date Start date
K

Kristof

When I make a query, I can choose "count" as a function.

Suppose I have one customer who bought 2 products in 1
order.

If I ask the query to count the number of orders, the
result will be 2 because he counts the orderlines. Now, I
want the query to count the distinctive orderlines, so the
result should become one.

How can I do this?
 
This might be the long way about it, but here is how i've
done something similar in the past.

Do you have a distinctive field for the order number
(order_ID)? If you have that you can create a group by
query using both customer_id and order_id (set both to
group by). Then you create a second query and base it off
of that first query. Put both fields in and make it a
group by, but this time use count under the Order_ID field.

Hope that helps!

Jessica
 
Thank you very much.

This could work.

-----Original Message-----
This might be the long way about it, but here is how i've
done something similar in the past.

Do you have a distinctive field for the order number
(order_ID)? If you have that you can create a group by
query using both customer_id and order_id (set both to
group by). Then you create a second query and base it off
of that first query. Put both fields in and make it a
group by, but this time use count under the Order_ID field.

Hope that helps!

Jessica



.
 
Back
Top