Click here to Skip to main content
15,884,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i HAVE Four table in sql database,
SQL
PointCategory Table
id     pointname      point_Category
1        xxx               A
2         XCV              B

Second Table
SQL
EmployeeCategory Table
id      Employee_Id       Emp_Category
1         mmm                  A
2         DDD                  B
3         XXX                  A         

Third Table
SQL
EmployeeStatus
id     Employee_Id         EmpStatus_Id     EndDATE
1           mmm              1               2015-2-13
2           mmm              2               2015-2-14
3           mmm              3               2015-2-15
4           XXX              1               2015-2-13
5           XXX              3               2015-2-12

and Last one Allocation tABLE
SQL
Id        pointCategory_Id        Employee_Id      DATE
1            A                      mmm            2015-2-13
2            B                      XXX            2015-2-13

I WANT a Query or series of Queries that fullfill the following step.
1.First Check Employee Category FROM employeeCategory table.Get A list of employee with same category. 
2.then from EmpStatus table where multiple records against same employee are present ,get last record of all employee which have same category AND same EmployeeStatusType_Id as  WE get in above point.
3.then check against each employee THAT we get from EmployeeStatus Table that if that Employee is allocated at point which has category "A" previously ,THEN allocate that Employee at a point WHICH HAS category "B". 
Posted
Comments
Afzaal Ahmad Zeeshan 20-Mar-15 23:43pm    
Do you mean to say, Entity framework?
Sajid227 21-Mar-15 0:30am    
yes EF FOR entity FRAMEWORK

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900