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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-08-31 : 10:30:09
|
| Mike writes "Here's my SQL Statement (I'm using MS SQL 2000):SELECT TOP 2 MenuComments, MenuDate, MenuID, MenuIsActive, MenuNameFROM MenuORDER BY MenuDate DESCThis orders the data correctly, but the problem is, I need the SECOND row, not the top row. Also, because I am sorting for menus entered into the system, I cannot use a variable based on real dates (in other words, I can't use the server clock to help filter the results). Any and all help would be GREATLY appreciated -- I've been banging my head against this one all day!Mike" |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-08-31 : 10:33:12
|
[code]select TOP 1 MenuComments, MenuDate, MenuID, MenuIsActive, MenuNamefrom( SELECT TOP 2 MenuComments, MenuDate, MenuID, MenuIsActive, MenuName FROM Menu ORDER BY MenuDate DESC) aORDER BY MenuDate[/code] KH |
 |
|
|
|
|
|
|
|