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 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-11-14 : 08:25:56
|
| I've got a query that returns values built into a drop-down list. They're alphabetically ordered, but I want to remember the order they were selected. Most recently referenced on top, 2nd most recent next, etc, in order of history visited.CREATE TABLE dbo.Mylist (name varchar (20),order INT)A procedure is called passing a value for 'name' selected by the user. I want to move 'name' to the top (e.g. value of Order becomes 1). All other values for order in the table drop down 1.How hard is that? Sam |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-11-14 : 08:52:23
|
| Could you use datetime to order by??? |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-11-14 : 08:57:21
|
I see your point. The solution jumps out atcha with DATETIME.Puts me in a spot here. If this was a contest I'd hafta say winner !Have a ehorn.Sam |
 |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-11-14 : 09:06:44
|
| Key word for me... "Recent"Keep the questions commin Sam, always interesting posts.. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-11-14 : 09:35:13
|
| couldn't even an identity work? just order by DESC.(I know, I know, identities are not guaranteed to be ordered and all that, just unique, but it would work because we know how SQL Server implements identities and that is by incremementing the IdentitySeed by 1).- Jeff |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-11-14 : 12:08:59
|
| Hell, it sounds just like the pick list for fonts in wordSELECT * FROM TABLE ORDER BY RECENT SELECTIONUNION ALLSELECT * FROM TABLE ORDER BY NAMENo?I like datetime...it allows you to eliminate things you consider to be not recent...Brett8-) |
 |
|
|
|
|
|