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 |
|
stronius
Starting Member
8 Posts |
Posted - 2010-07-20 : 11:24:59
|
I have a table consisting of ID's, and Date's. I've already been able to get the most recent entry by using the command : (SELECT [Batch_ID] FROM [dbo].[CustomerBatch] WHERE [Batch_ID] = IDENT_CURRENT('CustomerBatch'))Is there a way I can get the most recent entry from 2009? (Most recent record of 2009)Thanks! |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2010-07-20 : 12:08:24
|
Here is one way:SELECT TOP 1 [Batch_ID] FROM [dbo].[CustomerBatch] WHERE DateColumm >= '2009-01-01' AND DateColumm < '2010-01-01'ORDER BY DateColumn DESC |
 |
|
|
|
|
|