0

I have 3 tables in SQL Server 2008:

ACCOUNT(username,password,task);
COMMENT(idcom,content,username,time,idtopic);
TOPIC(idtopic,title);

I've had a query to get NUM (row number), idcom, content, iptopic, username,task,time:

select ROW_NUMBER() over (order by (select 1)) as NUM, idcom, content, idtopic, b.username, b.task, time 
 from COMMENT a 
 LEFT JOIN ( select username, task from ACCOUNT) b 
 ON a.username=b.username 
 where idtopic='1' ---> I call it: Temp Table

Then I want to get all rows from Temp Table from row 6 (7,8,9,...). I've tried many times but it seems I dont know the right syntax? Help?

4

1 回答 1

0

Select * from (select ROW_NUMBER() over (order by (select 1)) as NUM, idcom, content, idtopic, b.username, b.task, ti​​me from COMMENT a LEFT JOIN (select username, task from ACCOUNT) b ON a.username=b.username where idtopic='1' )x where x.Num > 6

于 2013-09-30T15:45:50.620 回答