November 26th, 2003, 04:03 PM
-
join+query
Hello Guys,
I have a query :
select id,name,address
from
(select * from
(select id,name,address from call)
union all
(select id,name,address from call2)
)
it gives me for example 3 records from table call and call2 :
1 jack USA
2 tom USA
4 harry canada
I have another table subscription containing the coloums : name, subscription_type containing the data:
jack prepaid
tom postpaid
harry normal
I want to modify the query so that I get the id,name,address from call and call2 and subsription_type from subscriber table for the name 'jack'
The results sshould be like this : 1 jack USA prepaid
Thanks in advance
Smith
November 26th, 2003, 04:46 PM
-
Code:
select id,c.name,address, subscription_type
from call c, subscription s
where c.name = 'jack'
and c.name = s.name
union
select id,c.name,address, subscription_type
from call2 c, subscription s
where c.name = 'jack'
and c.name = s.name