sql - calculate experience of employee -
Display employee's total counting experience and employees who have more than 5 years of experience ...
Please help me in advance thanks.
Select tbl_Employee.EFirstName, tbl_Employee.EMiddleName, tbl_Employee.ELastName, tbl_Emplâ ???? One ???? Oyee.EmployeeID, tbl_BranchMaster.BranchName, tbl_DepartmentMaster.DepartmentName, basic, year as Tbl_StateMaster.ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, State Government, tbl_Employee.EmployementDate, dbo.FN_Basic (tbl_Employee.EmployeeID). (Strict () (age) - YEAR (tbl_Employee.EmployementDate) as age tbl_StateMaster Inner included tbl_DepartmentMaster join INNER tbl_EmployeeStructureInternet tbl_EmployeeStructure.EmployeeID = tbl_Employee.EmployeeID tbl_Employee Join interactive on tbl_DepartmentMaster.DepartmentID = tbl_EmployeeStructure.DepartmentID Tbl_StateMaster.StateID = tbl_EmployeeStructure.StateID
If the employee is present then drop table; create the table worker (id INT, joining_date DATETIME); inserting in `Employee` (` id`, `joining_date `) Values ('1', NOW ()), ('2', NOW (- INTERVAL 6 YEAR); Choose from the staff; + ------ + --------------------- + | ID | Joining_date | + ------ + --------------------- + | 1 | 2014-02-17 17:56:53 | | 2 | 2008-02-17 17:56:53 | + ------ + --------------------- + 2 lines set (0.00 seconds) SELECT id, joining_date employee WHERE DATEDIFF (DATE (now ( )), DATE (joining_date)) / 365 & gt; 5; + ------ + --------------------- + | ID | Joining_date | + ------ + --------------------- + | 2 | 2008-02-17 17:56:53 | + ------ + --------------------- + 1 line set (0.01 seconds) You + Where DATE_FORMAT (FROM_DAYS - Also select ID, joining_date, DATE_FORMAT (TO_DAYS (joining_date), '% Y' FROM_DAYS (TO_DAYS (NOW)) from Employee as a YearsOfExp ) (TO_DAYS (NOW ()) - TO_DAYS (joining_date), '% Y') + 0> 5; + ------ + --------------------- + ------------ + | ID | Joining_date | OFF of the year + ------ + --------------------- + ------------ + | 2 | 2008-02-17 17:56:53 | 6 | + ------ + --------------------- + ------------ + 1 line set (0.00 seconds)
You can type index optimally for
select from where employee joining_date & lt; = DATE_ADD (NOW (), interval -5 years);
Comments
Post a Comment