Forum Moderators: open

Message Too Old, No Replies

select count distinct - is it possible?

         

musicales

9:39 am on Jan 25, 2006 (gmt 0)

10+ Year Member



I am trying to count the number of distinct products in my shopping basket table (which of course has multiple product_ids as different customers add the product to their cart)

The effective code I'm after is select count distinct (product_id) - which of course doesn't work.

I use sql2000

Any suggestions how to do this?

chrisjoha

11:42 am on Jan 25, 2006 (gmt 0)

10+ Year Member



I don't know you're particular server, but I think you'd come a long way with

SELECT COUNT(distinct field) FROM tablename

musicales

11:47 am on Jan 25, 2006 (gmt 0)

10+ Year Member



that was easy!

Thanks a lot