Click here to Skip to main content
15,891,903 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a team and in that I have a team members ... In my other module if I want to add other members in my team then I select the department and it will show all the members of that department ... But the problem is I want to show only those members of that department who is not in that team ...In hibernate
Employee Table :

private Integer EId;
private Department department;
private String firstName;
private int number;
private String image;
private String emailId;
private Date dateOfBirth;


Teamdata Table :

private Integer no;
private EmployeeRegistration employeeRegistration;
private TeamMaster teamMaster;

What I have tried:

String str = "from EmployeeRegistration as emp where emp.EId NOT IN (from TeamData as team where team.teamMaster = '"+teamid+"' )";
Posted
Updated 13-Nov-16 17:07pm

1 solution

The following general solution will find rows in table x that are not linked in table y. It makes use of Except in SQL, to accomplish what you are trying to do. Hope this helps.

var linked =
from x in dc.X
from y in dc.Y
where x.MyProperty == y.MyProperty
select x;
var notLinked =
dc.X.Except(linked);
 
Share this answer
 

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