Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

what is the difference between count(*) and count(1) ?

1045


what stored procedure can you use to display the current processes? : Sql server administration

978


Explain primary key, foreign key and unique key?

947


Explain triggers?

964


What is sql server schema compare? How we can compare two database schemas?

988


Define inner join in sql server joins?

1012


Give a example to search fr a string in all stored procedure in sql server.

932


What is replace and stuff function in sql server?

1022


How do I make a resultset scrollable?

933


Can we check locks in database? If so, how can we do this lock check?

911


How to find the version of sql server? : sql server database administration

1066


What do you mean by an execution plan? Why is it used? How would you view it?

893


How can a user-defined datatype be created?

953


How is sql server used?

927


What is the exact numeric data type in sql?

973