- 
	
	
		
		
			
				
				
				
					Query employee name who is not in dept no 30
				
				
						
							
							
						
						
				
					
						
							Question asked by Guest Visitor ramesh
there is two tables emp and dept i want query for this one
max sal of employe and employee name who is not in dept no 30
dept no columin is in dept ,empid is common coulumn in two tables
						
					 
					
				 
			 
			
			
		 
	 
		
	
 
                                             
- 
	
	
		
			
			
				Expert Member
			
			
			
			
				
					
						
					
				
			
			 
			
				
				
				
				
				
					    
				
			
		 
		
			
				
				
				
					Re: Query employee name who is not in dept no 30
				
				
						
						
							
						
				
					
						
							I assume that empid column in both emp and dept table.
select emp_id,emp_name
from emp,dept
where emp.emp_id=dept.emp_id
and dept_id !=30
and emp.salary =(select max(salary) 
                        from employee 
		         where emp_id not in (select emp_id 
		                                      from dept 
				                      where dept_id !=30
                                                     )
                       )
						
					 
					
				 
			 
			
			
		 
	 
		
	
 
                                             
		
		
		
	
 
	
	
	
	
	
	
	
	
	
	
	
	
		
		
			
				
				Posting Permissions
			
			
				
	
		- You may not post new threads
 
		- You may not post replies
 
		- You may not post attachments
 
		- You may not edit your posts
 
		-  
 
	
	
	Forum Rules