Connecting Tech Pros Worldwide Forums | Help | Site Map

Please solve a sql query to show data from 3 table.

Newbie
 
Join Date: Oct 2008
Posts: 1
#1: Oct 26 '08
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.

Newbie
 
Join Date: Oct 2008
Posts: 5
#2: Oct 28 '08

re: Please solve a sql query to show data from 3 table.


hi there.. it seems i have read ur article late.. anyways .. it can be. done..
but first post ur query. and let me have a look at it. i cant post the answer directly according to the rules of this forum. but would love to guide u.
have u tries nested queries?
Reply