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  | 
                             
                            
                                    | 
                                         skaswani 
                                        Starting Member 
                                         
                                        
                                        24 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2008-07-06 : 05:40:29
                                            
  | 
                                             
                                            
                                            | Dear Friendscan u hlp me to re-write this query?SELECT scn.TransactionDate, Count(*) AS Expr2 FROM scn where BranchCode is nullGROUP BY scn.TransactionDate;UNION SELECT scn.TransactionDate, Count(*) AS Expr1 FROM scn where BranchCode is not nullGROUP BY scn.TransactionDate;what i want to do is, i want a TransactionDate and Expr2 as UnPaid_Count and Expr1 as Paid_Count into a Table name Statusbut one more thing.. it should not insert DUPLICATE RECORDsDatabase = Access 2000 with VB 6 | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     AndrewMurphy 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    2916 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-07-07 : 03:17:28
                                          
  | 
                                         
                                        
                                          | Have a look at the CASE clause....CASE BRANCHCODE WHEN NULL xxxx ELSE xxxx ENDThere are several examples of this sort of maths on this site.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |