This is really dumb question but still my head cannot work it out. I have a table with Orders, each order has userID in it. User can have unlimited amount of Orders. How do i make count of unique userIDs ?
                +8 
                A: 
                
                
              You can;
SELECT COUNT(DISTINCT userID) 
FROM Tbl
You can give the count column a name by aliasing it:
SELECT COUNT(DISTINCT userID)  NumberOfDistinctUsers
FROM Tbl
                  Alex K.
                   2010-06-21 12:42:11
                
              Thanks, works.... placed DISTINCT before count and got wrong result...
                  eugeneK
                   2010-06-21 12:45:00
                
                +3 
                A: 
                
                
              
            select count(*) from
(select distinct userid form ordertable) d
                  Pranay Rana
                   2010-06-21 12:42:23