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 |
|
hristo
Starting Member
2 Posts |
Posted - 2007-06-28 : 04:31:59
|
| I need to get the three latest entries in a table and I'm comparing on a column with datatype DATETIME with format 2007-06-27 16:20:43.There's probably an easy solution but I'm pretty new to all this so bear with me.So far I have experimented with the TOP clause:SELECT TOP 3 *FROM (SELECT * FROM TABLENAME order by COLUMNNAME desc)without any success.I also thought about the MAX clause but that returns only a single value.Any help would be appreciated./Hristo |
|
|
Koji Matsumura
Posting Yak Master
141 Posts |
Posted - 2007-06-28 : 04:55:47
|
| SELECT TOP 3 * FROM TABLENAME order by COLUMNNAME desc |
 |
|
|
hristo
Starting Member
2 Posts |
Posted - 2007-06-28 : 05:15:48
|
| Thanks, that did it. I made it harder than it was. Didn't realize that order worked that way.Great, that solved my problem. |
 |
|
|
|
|
|