rory oconnor <[EMAIL PROTECTED]> writes:

[...]

> each item in a cart is a record, so simply querying on records won't
> work.  What I need to count is how many distinct customerId's there
> are.  a sample from the table looks like:
> 
> cartItemId    customerId      productId
> 1944          244             2139
> 1945          244             2234
> 1946          244             8291
> 1947          198             4435
> 1948          198             3342
> 1949          221             3324
> 1950          221             4432
> 
> so in this example, the number of abandoned carts would be 3, because
> there are only three unique customerId's.
> 
> Any help on what that query would look like is appreciated!  

Something like SELECT DISTINCT(customerID) FROM cart should give you
want you want.  See the mysql documentation for SELECT and DISTINCT
for more details on exactly how these work.

-----ScottG.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to