Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with. 
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         danielhieb 
                                        Starting Member 
                                         
                                        
                                        2 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2013-02-12 : 19:21:27
                                            
  | 
                                             
                                            
                                            | SELECT DISTINCT Type, Version,		COUNT(*)FROM STOVEGROUP BY TYPE, VERSION;Does Count(*) count just the selected columns(i.e. type, version)? If so, does it always count just the selected columns? | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     jimf 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    2875 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-02-12 : 20:34:10
                                          
  | 
                                         
                                        
                                          | It counts all the rows in  the group TYPE, VERSION.  In your example, you don't even need the DISTINCT.  If you want to count the distinct things in the group TYPE,VERSION, you can do something likeSELECT TYPE,VERSION, COUNT(DISTINCT InterestingColumn)FROM STOVEGROUP BY TYPE, VERSION;If you want to know just how many different TYPE,VERSION combos you have, you can just doSELECT   Type, Version  FROM STOVEGROUP BY TYPE, VERSION;and see how many records there are, or doSELECT COUNT(*) *FROM(SELECT  Type, Version FROM STOVEGROUP BY TYPE, VERSION ) t1JimEveryday I learn something that somebody else already knew  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     danielhieb 
                                    Starting Member 
                                     
                                    
                                    2 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-02-12 : 20:39:27
                                          
  | 
                                         
                                        
                                          | Thanks!Daniel Hieb  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |