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

What are exact numeric data types in ms sql server?

701


What does it mean to invest in the index?

717


What do you understand by sql server agent?

701


Relational calculus is what type of language?

792


hi, the following are the outputs of sp_spaceused and sp_tempdbspace sp_spaceused ------------ database size unallocated size tempdb 77752.95 MB 28026.99 MB sp_tempdbspace ------------- database size spaceused tempdb 77752.945312 1.007812 the unused space in sp_spaceused is nearly 28 Gb and in sp_tempdbspace is nearly 76 Gb cany any one explain about this output and why its giving different results.

2687


Difference between Inner vs outer joins?

704


Do you know what guidelines should be followed to help minimize deadlocks?

733


What is difference between clustered and non clustered index?

712


How extra digits are handled with numeric data type literals?

703


How to change server name in sql server?

813


How much is a sql server license?

706


What is wrong with sql server client libarary dll, ntwdblib.dll?

755


What are the properties of sub-query?

797


Why do we use non clustered index?

747


How to insert stored procedure result into temporary table?

785