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  | 
                             
                            
                                    | 
                                         bibiqna_91 
                                        Starting Member 
                                         
                                        
                                        3 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2011-04-04 : 14:57:48
                                            
  | 
                                             
                                            
                                            I use this code but i need the information in alphabetical order.Could you please tell me where to put the ORDER BY mem_name?SELECT members.mem_name, roles.role_nameFROM rolesINNER JOIN membersON roles.mem_no=members.mem_noWHERE roles.level LIKE "national" OR roles.level LIKE "regional";  Many thanks in advance :) | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     robvolk 
                                    Most Valuable Yak 
                                     
                                    
                                    15732 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-04-04 : 15:00:02
                                          
  | 
                                         
                                        
                                          | SELECT members.mem_name, roles.role_nameFROM rolesINNER JOIN membersON roles.mem_no=members.mem_noWHERE roles.level LIKE "national" OR roles.level LIKE "regional";ORDER BY members.mem_name  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     bibiqna_91 
                                    Starting Member 
                                     
                                    
                                    3 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-04-05 : 07:14:30
                                          
  | 
                                         
                                        
                                          | thank you :)  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     AndrewMurphy 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    2916 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-04-05 : 10:46:53
                                          
  | 
                                         
                                        
                                          | or to be more accurateSELECT members.mem_name, roles.role_nameFROM rolesINNER JOIN membersON roles.mem_no=members.mem_noWHERE roles.level LIKE "national" OR roles.level LIKE "regional"ORDER BY members.mem_nameNote that you have no % after the variables in the LIKE clauses (i.e. national% and regional%)this will prevent you getting variations of these names...which is the main benefit of using the LIKE clause  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     bibiqna_91 
                                    Starting Member 
                                     
                                    
                                    3 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-04-08 : 21:17:27
                                          
  | 
                                         
                                        
                                          | Ye i got it :) Thank you :)  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |