Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004
    Posts
    1

    Unanswered: need to get sth which is more than avg

    Hello,
    this gives me average films by distributors:

    select avg(tblcnt.cnt) from

    (select d.name, count(f.original_tytle) cnt from licences l, distributors d, films f
    where l.id_distributor = d.id and f.id_licences = l.id
    group by d.name
    order by cnt) tblcnt


    question:

    I want to get distributors they have more films than this average number

    Thank you, h

  2. #2
    Join Date
    Aug 2004
    Posts
    330
    select dd.name, count(ff.original_tytle) cnt from licences ll, distributors dd, films ff
    where ll.id_distributor = dd.id and ff.id_licences = ll.id
    group by dd.name
    having count(ff.original_tytle) >

    (select avg(tblcnt.cnt) from

    (select d.name, count(f.original_tytle) cnt from licences l, distributors d, films f
    where l.id_distributor = d.id and f.id_licences = l.id
    group by d.name
    order by cnt) tblcnt)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •