sql server - How do I get employee details if they are earning more than their paylevel? -


i have database employees , employees has paylevel according experience (calculated hire date) earn higher because of previous experience. have 2 tables employee table (details employee including paylevel number) , paylevel table (details of pay level) years of experience calculated. question employees earning more paylevel says earn. connected view.

select accountant_name, hire_date, pay_level_name, 'pay_level_no' convert (int,experience_in_years) 'xp in years' accountant_view; 

so how see whether pay level of each employee matches salary of specific pay level number (salary in paylevel table) not sure whether asking in right way appreciated.

create table paylevel (paylevel_no smallint identity (1,1), paylevel_name varchar (25) not null, annual_pay money not null, min_experience char (3) not null,  constraint paylevel_pk primary key (paylevel_no) ); go  create table accountant (accountant_id int not null identity (01, 1), branch_id smallint not null, paylevel_no smallint not null, first_name varchar (20) not null 

given information provided (and without actual table schemas unfortunately) following act guide.

the basic premis actual pay employee earns needs compared expected pay means of matching pay levels in each table:

select emp.id, emp.paylevel, emp.actualpay, pl.paylevel, pl.pay_level_name, pl.expectedpay employees emp inner join paylevels pl on pl.paylevel = emp.paylevel  emp.actualpay > pl.expectedpay 

hope assists


ravinda,
updated schema, here statement use. have surmised somewhere in accountant table have column actual pay value.

select ac.accountant_id, ac.first_name, ac.branch_id, pl.paylevel_name, pl.annual_pay, ac.actual_pay accountant ac inner join paylevel pl on ac.paylevel_no = pl.paylevel_no ac.actual_pay > pl.annual_pay 

please provide actual pay column or source can refined better,

thanks,


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -