how do we find every fifth record in a table
Answer Posted / saravanan p
If we consider employee2 table having 16 records like
Name Salary
Ajith 10000
Arithas 2000
Balaji 20000
Gamesh 20000
Jith 23000
keerthy 14000
boopathy 21000
moorthy 12000
Muthu Krishnan 30000
Muthu Kumar 80000
naveen 10200
neerthy 40000
Raja 12000
Ramesh 12000
sangeeth 1100
Vairam 23000
With Temp as
(
select row_number() over(order by [name]) as 'rno',
[name] from employee2
)
select [name],salary from Temp
where rno%5 = 0
The result..
Name Salary
Jith 40000
Muthu Kumar 15000
sangeeth 50000
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is scheduled job and how to create it?
Can you always create a cache of a report?
Why I am getting "the microsoft .net framework 2.0 in not installed" message?
can an order by clause be used in a creation of a view?
What is the difference between char, varchar and nvarchar?
Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?
How to execute a stored procedure in ms sql server?
what information is maintained within the msdb database? : Sql server administration
How many files can a database contain in sql server?how many types of data files exists in sql server? How many of those files can exist for a single database?
How to loop through returning rows?
How much memory that we are using in Logshipping Concept?
How to connect php with different port numbers?
What is sql server used for?
What is the difference between deallocate cursor and close cursor?
Characterize join and name diverse sorts of joins?