Without using order by
-
Hi, i have a table of employee details where i have empno, name, salary. i need to select the salary from the table in the descending order. the condition here is that I should not use order by clause.
If U Get Errors U Will Learn If U Don't Get Errors U Have Learnt
-
Hi, i have a table of employee details where i have empno, name, salary. i need to select the salary from the table in the descending order. the condition here is that I should not use order by clause.
If U Get Errors U Will Learn If U Don't Get Errors U Have Learnt
-
Are you trying to do this in an inline query. what is your actual requirement.
Regards KP
-
Hi, i have a table of employee details where i have empno, name, salary. i need to select the salary from the table in the descending order. the condition here is that I should not use order by clause.
If U Get Errors U Will Learn If U Don't Get Errors U Have Learnt
I could never see any reason for ever not using an order by clause to sort the output of a query. The only other alternative I can think of is by setting the salary to be the primary key on a clustered index and see if that works. This would of course be very bad design methodology as the empno field would make better sense as the primary key. I would be more than happy to be proved wrong and am interested in what solution you come to. Regards Guy
You always pass failure on the way to success.
-
Hi, i have a table of employee details where i have empno, name, salary. i need to select the salary from the table in the descending order. the condition here is that I should not use order by clause.
If U Get Errors U Will Learn If U Don't Get Errors U Have Learnt
Try something like this:
CREATE TABLE #MyTempTable (salary decimal(28,12)) INSERT INTO #MyTempTable SELECT salary FROM employeedetails GROUP BY salary CREATE INDEX salary ON #MyTempTable (salary DESC) SELECT * FROM #MyTempTable
Regards GuyYou always pass failure on the way to success.
modified on Friday, December 28, 2007 6:15:09 AM
-
Hi, i have a table of employee details where i have empno, name, salary. i need to select the salary from the table in the descending order. the condition here is that I should not use order by clause.
If U Get Errors U Will Learn If U Don't Get Errors U Have Learnt
This sounds very suspiciously like homework to me. We don't actually do your homework for you, so you'd better let us know what you've tried beforehand.
Deja View - the feeling that you've seen this post before.
-
Try something like this:
CREATE TABLE #MyTempTable (salary decimal(28,12)) INSERT INTO #MyTempTable SELECT salary FROM employeedetails GROUP BY salary CREATE INDEX salary ON #MyTempTable (salary DESC) SELECT * FROM #MyTempTable
Regards GuyYou always pass failure on the way to success.
modified on Friday, December 28, 2007 6:15:09 AM