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  | 
                             
                            
                                    | 
                                         mdixon44 
                                        Starting Member 
                                         
                                        
                                        26 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2008-05-15 : 11:29:28
                                            
  | 
                                             
                                            
                                            | I need some assistance with this. I would apprecieate it.Using the L_Employees table, write a query which outputs first_name, last_name, and 2 extra columns called "Exempt" and "Non-Exempt". Use the IIF function to populate these new columns with dept_code values as such: "Exempt" column should contain dept_codes "Exe" and "Sal". "Non-exempt" column should contain all other dept_codes. I came up with this:select first_name,       last_name,       iif(dept_code ='Exe', 'Sal') as Exempt,       iif(dept_code = 'Act','Shp','Mkt') as Non_Exemptfrom l_employeesIt is not giving the query table in this Access SQL code | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     jsmith8858 
                                    Dr. Cross Join 
                                     
                                    
                                    7423 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-05-16 : 14:06:15
                                          
  | 
                                         
                                        
                                          | remember how IIF() works:IIF( condition, return_this_if_true, return_this_if_false)so, you put your condition in and then the true and false parts.I think you want something like this:iif(dept_code in('exe','sal'), dept_code, null) as Exempt..etc...But your requirements seem very odd.- Jeffhttp://weblogs.sqlteam.com/JeffS  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     mdixon44 
                                    Starting Member 
                                     
                                    
                                    26 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-05-16 : 16:23:54
                                          
  | 
                                         
                                        
                                          Thank you for that advice.. It worked perfectly.. I apprecieate it.quote: Originally posted by jsmith8858 remember how IIF() works:IIF( condition, return_this_if_true, return_this_if_false)so, you put your condition in and then the true and false parts.I think you want something like this:iif(dept_code in('exe','sal'), dept_code, null) as Exempt..etc...But your requirements seem very odd.- Jeffhttp://weblogs.sqlteam.com/JeffS
    | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |