I want to display 5th record in the first row How? in SQL

Posted by Gg under ASP.NET on 8/10/2011 | Points: 10 | Views : 1589 | Status : [Member] | Replies : 3
Hi,

I am having two partial class with same method name what will happen when i compile whether it will throw error or not?

Im having 10 records in the table I want to display 5th record in the first row How? in SQL

Thanks,
jj.




Responses

Posted by: Hmanjarawala on: 8/10/2011 [Member] Bronze | Points: 25

Up
0
Down
Ya if two partia class have a same method name with same signature...it ll show an error "multiple defination found", but if signature are different then it will considered as overloaded method.

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Gg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dhirendra on: 8/11/2011 [Member] Starter | Points: 25

Up
0
Down
IN case of partial classes and methods..if signature are different then it will allowed and if signature are same then it will not allowed two partial definations.

below is the SQL which will help you to return 5 record at the top and other records at the bottom.

employee table structure

Column_name Type
ID int
EmpNumber varchar
Status varchar
Manager varchar
EmpType varchar

SQL to execute

with employeetemp
as
(select ID, EmpNumber, Status, Manager, EmpType, ROW_NUMBER() OVER (ORDER BY ID) as RowNumber from employee
)
select ID, EmpNumber, Status, Manager, EmpType from employeetemp
where RowNumber>=5
union all
select top 4 ID, EmpNumber, Status, Manager, EmpType from employeetemp

Gg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A4u_6178 on: 8/11/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,
For ur second Question
Try Like This..

SELECT name,sal FROM emp e1 Where n=(select Count(distinct(sal)) From emp e2 

WHERE e2.sal>=e1.sal)


This Query can be used to find the nth max salary the number with the where clause should be n-1 .
For more on Sql Queries..
http://sqlservercodebook.blogspot.com/2008/03/find-3rd-max-salary.html

Thanks & Regards,

Gg, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response