oracle:
sql如下
select rownum rn,b.* from
(
select a.movie_count,mi.* from
(
select count(mpi.movie_id) movie_count,mpi.movie_id from movie_playhis_info mpi,ixterminal tml
where mpi.tml_id = tml.tml_id and tml.cinema_id = 5 and tml.group_id = 6 and mpi.start_time > '2010-01-01' and
mpi.start_time < '2020-01-01' group by mpi.movie_id
) a,movie_info mi
where a.movie_id = mi.movie_id ORDER BY A.MOVIE_COUNT DESC
) B
换成sql server如何写
sql如下
select rownum rn,b.* from
(
select a.movie_count,mi.* from
(
select count(mpi.movie_id) movie_count,mpi.movie_id from movie_playhis_info mpi,ixterminal tml
where mpi.tml_id = tml.tml_id and tml.cinema_id = 5 and tml.group_id = 6 and mpi.start_time > '2010-01-01' and
mpi.start_time < '2020-01-01' group by mpi.movie_id
) a,movie_info mi
where a.movie_id = mi.movie_id ORDER BY A.MOVIE_COUNT DESC
) B
换成sql server如何写
(
select a.movie_count,mi.* from
(
select count(mpi.movie_id) movie_count,mpi.movie_id from movie_playhis_info mpi,ixterminal tml
where mpi.tml_id = tml.tml_id and tml.cinema_id = 5 and tml.group_id = 6 and mpi.start_time > '2010-01-01' and
mpi.start_time < '2020-01-01' group by mpi.movie_id
) a,movie_info mi
where a.movie_id = mi.movie_id ORDER BY A.MOVIE_COUNT DESC
) B
楼主 这个你在oracle执行正确吗 mpi.start_time > '2010-01-01' and
mpi.start_time < '2020-01-01'