Can I do a max(count(*)) in SQL?

前端 未结 11 1802
遥遥无期
遥遥无期 2020-11-29 01:02

Here\'s my code:

    select yr,count(*)  from movie
join casting on casting.movieid=movie.id
join actor on casting.actorid = actor.id
where actor.name = \'Jo         


        
11条回答
  •  攒了一身酷
    2020-11-29 01:59

    create view sal as
    select yr,count(*) as ct from
    (select title,yr from movie m, actor a, casting c
    where a.name='JOHN'
    and a.id=c.actorid
    and c.movieid=m.id)group by yr
    

    -----VIEW CREATED-----

    select yr from sal
    where ct =(select max(ct) from sal)
    

    YR 2013

提交回复
热议问题