By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,763 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,763 IT Pros & Developers. It's quick & easy.

How to write query that will return data from three different tables?

P: 1
Hi

Please help me solving this query..
I have 3 tables..
comm_propDB
Expand|Select|Wrap|Line Numbers
  1. ID  |  User_ID |   mls_num
  2. -----|---------------|---------------------
  3. 2   |     2        |       5004
  4. 3   |     2        |       8920
  5. 8   |     2        |       5540
  6. 5   |     3        |       5263
  7. 6   |     3        |       9999
  8. 7   |     8        |       1212

comm_propDBElements

Expand|Select|Wrap|Line Numbers
  1. ID  |   agent_ID |   user_ID
  2. -----|----------------|---------------------
  3. 42  |      845    |        3
  4. 43  |      845    |        3
  5. 44  |      269    |        2
  6. 88  |      300    |        2
  7. 46  |      124    |        8
  8. 47  |      840    |        7

ALL_ALLOWED_AGENT
Expand|Select|Wrap|Line Numbers
  1. ID     agent_ID  
  2. -----|---------------
  3. 1   |    845
  4. 2   |    124
I want to write a query that will fetch data from comm_propDB table & comm_propDBElements table if agentID is present in ALL_ALLOWED_AGENT like this :-
Expand|Select|Wrap|Line Numbers
  1. ID   agent_ID   User_ID    mls_num
  2. ---------------------------------------------------
  3. 2       845            2             5004
  4. 3       845            2             8920
  5. 8       845            2             5540
  6. 7       124            2             5004

I have tried everything but couldn`t succeed to solve this query.I also searched on net but didn`t get any perfect solution.
Please suggest the right query.

Thanks a lot.
Oct 26 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.