日期:2014-05-17 浏览次数:20502 次
With TTTTT AS
(
select productid,productname,price,pictureshow,updatetime from product A
left join (select kindid,brandid from Kind) B on A.kindid=B.kindid
where B.brandid=@brandid
)
select * from
(
select ROW_NUMBER() OVER (ORDER BY updatetime desc) as rownumber,* from TTTTT
) as T
where rownumber between 1 and 10
With TTTTT AS
(
select productid,productname,price,pictureshow,updatetime from product A
left join (select kindid,brandid from Kind) B on A.kindid=B.kindid
where B.brandid=@brandid
)
select * from
(
select ROW_NUMBER() OVER (ORDER BY updatetime desc) as rownumber,*,(select count(*) from TTTTT) as cnt from TTTTT
) as T
where rownumber between 1 and 10
--try
With TTTTT AS
(
select productid,productname,price,pictureshow,updatetime ,
count(*)over()总行数
from product A
left join (select kindid,brandid from Kind) B on A.kindid=B.kindid
where B.brandid=@brandid
)
select * from
(
select ROW_NUMBER() OVER (ORDER BY updatetime desc) as rownumber,* from TTTTT
) as T
where rownumber between 1 and 10