Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jesus4u
Posting Yak Master
204 Posts |
Posted - 2003-01-02 : 10:59:26
|
| From a SELECT statement, can I say SELECT 10 records BUT take the last record and put it on the TOP of the result?example:12345678910change to:10123456789Thanks |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-01-02 : 11:30:04
|
| If you are ordering by ID, you could try something like:SELECT * FROM(SELECT A.*, CASE WHEN A.ID = (SELECT Max(ID) FROM Table) THEN -1 ELSE A.ID END AS SortFROMTable A)ORDER BY Sort ASCAdd TOP's and criteria as necessary to the subqueries (be sure they are consistent).Alter the -1 result as needed to make sure you sort the MAX() to the beginning.- JeffEdited by - jsmith8858 on 01/02/2003 11:30:41 |
 |
|
|
|
|
|