日期:2014-05-17 浏览次数:20801 次
select NewsId,NewsTitle,NewsContent,NewsTime,NewsClick,NewsType,NewsAudi,
newstc,Newssource,updateuser,Newsimg,Statetype,psort,newspartinfo,
newspage,userid,StateTime,
rownum
from
(
select t1.*,
(
select count(*)
from
(
select NewsId,NewsTitle,NewsContent,NewsTime,NewsClick,NewsType,NewsAudi,
newstc,Newssource,updateuser,Newsimg,Statetype,psort,newspartinfo,
newspage,userid,StateTime,
convert(varchar(7),StateTime,120) as mon
from tb_News
where (NewsType = '时光树') and (userid = 1)
group by StateTime,NewsId,NewsTitle,NewsContent,NewsTime,NewsClick,NewsType,
NewsAudi,newstc,Newssource,updateuser,Newsimg,Statetype,psort,
newspartinfo,newspage,userid
) t2
where t2.mon = t1.mon
)-
(
select
count(*)
from
(
select NewsId,NewsTitle,NewsContent,NewsTime,NewsClick,NewsType,NewsAudi,
newstc,Newssource,updateuser,Newsimg,Statetype,psort,newspartinfo,
newspage,userid,StateTime,
convert(varchar(7),StateTime,120) as mon
from tb_News
where (NewsType = '时光树') and (userid = 1)
group by StateTime,NewsId,NewsTitle,NewsContent,NewsTime,NewsClick,NewsType,
NewsAudi,newstc,Newssource,updateuser,Newsimg,Statetype,psort,
newspartinfo,newspage,userid
) t2
where t2.mon = t1.mon
and t2.NewsId <= t1.NewsId
)+1 as rownum
from
(
select NewsId,NewsTitle,NewsContent,NewsTime,NewsClick,NewsType,NewsAudi,
newstc,Newssource,updateuser,Newsimg,Statetype,psort,newspartinfo,
newspage,userid,StateTime,convert(varchar(7),StateTime,120) as mon
from tb_News
where (NewsType =