Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have 3 tables in my db, Users, their organization and suboffices. i have to fetch all email of all users who have orgId = 1 and have office in islamabad city.

SQL
SELECT Email From Users Where OrgID = (SELECT  OrgID from  Organization where Name = 'ABC')  & (SELECT OrgID From SubOffice Where Name = 'xyz')

i have to get the matching orgId from both table and return to main query.
Posted
Updated 30-Oct-14 0:36am
v2
Comments
Praveen_P 30-Oct-14 6:18am    
Try using join

Have a look at this tutorial page. SQL Joins[^]

It should give you the basic info for getting started.
 
Share this answer
 
 
Share this answer
 
v2

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