-
Sql Query
hi!!!
i hv prob in a query.......
the tables r
cust(cust_id(PK),fname,lname,area,phone_no)
invoice(inv_no,mv_no(FK),cust_id(FK),issue_date,re turn_date)
movie(mv_no(PK),title,type,star,price)
the query is
List the movie no. and name issue to all customers.
tht is the query should return those mv_no which r issued to all d customers in cust table.
can anyone help???
thanx......:)
-
As far as homework problems go, this one is very easy. I'm sure your textbook has examples of this type of query. What have you tried on your own so far?
-
try this
select m.mv_no, m.title
from movie m
join (
(select count(cust_id) allcustno
from cust) c
join
(select mv_no, count(distinct cust_id) allcustno
from invoice
group by mv_no) inv
on c.allcustno = inv.allcustno) a
on a.mv_no=m.mv_no