how do we find every fifth record in a table

Answer Posted / saurabh tyagi

select id ,partcode from prt where id in
(

select case when row_number() over (order by partcode ) %
5 = 0
then row_number() over (order by
partcode)
else 0 end
from prt
)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain optimistic and pessimistic concurrency?

527


Why do we use stored procedures in sql server?

482


What are sql azure firewall rules?

85


What are the basic functions for master, msdb, model, tempdb databases?

578


What is the status of services on passive node for failover cluster in sql server? : sql server database administration

621






What does executeupdate return?

525


What is the difference between system objects and user objects?

695


What is an expensive query?

524


How to get the number of affected rows?

547


How to get a list of columns using the "sys.columns" view in ms sql server?

545


What is a database in ms sql server?

535


How to use go command in "sqlcmd"?

632


Your company has 50 branches all over the country all the branches, including the head office have sql server as the database every night all 50 branches upload certain information to the head office which replication topology is best suited for the above scenario?

608


What is the guest user account in sql server? What login is it mapped to it? : sql server security

571


How to disable a login name in ms sql server?

578