Select Query from three Tables .... [message #8590] |
Wed, 03 September 2003 02:01 |
pkmicf
Messages: 18 Registered: August 2002
|
Junior Member |
|
|
I have 3 tables like
table1
------
husband_name wife_name child_name child_age
------------ --------- ---------- ---------
raja rani manu 6
raja rani devi 5
gopu gowri aswin 7
gopu gowri indu 4
table2
------
parent_id husband_name wife_name
--------- ------------ ---------
1 raja rani
2 gopu gowri
table3
------
parent_id child_id child_name
--------- -------- ----------
1 1 manu
1 2 devi
2 3 aswin
2 4 indu
I need a query to extract from the above three tables like:-
parent_id child_id age
--------- -------- ----
1 1 6
1 2 5
2 3 7
2 4 4
Could any one please help.
Thanks in advance.
Yours
PKM.
|
|
|
Re: Select Query from three Tables .... [message #8591 is a reply to message #8590] |
Wed, 03 September 2003 03:16 |
Pawan
Messages: 33 Registered: June 2002
|
Member |
|
|
Please Try This One ....
I have not tested but resume will come correct
SELECT table_3.parent_id , table_3.child_id , Table_1.child_age FROM
TABLE_1, table_2, table_3 where
table_1.child_name = table_3.child_name and
table_2.parent_id = table_3.parent_id and
table_1.husband_name = table_2.husband_name and
table_1.wife_name = table_2.wife_name ORDER BY Table_3. parent_id
|
|
|