LINQ query to return boolen value

i have 3 tables Group1,Group2,and Group3  
each table contains employee details. i have employee whose ID is say 1 i want to check if this employee is there in any of the above table. Here i use ID to find any record present in any of the table..if i find any record  i have to return True or Fale/ Yes or No any thing...

i need query in LINQ to Entities....

i just need single query which checks the details sing ID...

can you please help on this...

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
Hi PradeepDumpala;

Something like this should do what you want.

// The employee ID to search for
int emplyeeID = 1;

ObjectDataContext db = new ObjectDataContext();
var foundEmployee = (from g1 in db.Group1
                     from g2 in db.Group2
                     from g3 in db.Group3
                     where g1.EmployeeID == emplyeeID | 
                           g2.EmployeeID == emplyeeID | 
                           g3.EmployeeID == emplyeeID
                     select new { g1, g2, g3 }).Any(g => g != null);


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PradeepDumpalaAuthor Commented:
good i will test it more
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.