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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 I need to pick Year end date..

Author  Topic 

MageshkumarM
Yak Posting Veteran

61 Posts

Posted - 2011-01-13 : 01:35:33
Hi to all,
I need small help,
I have a table called sample and it contain daily base data's from year 2001 till end 2010..

i.e:-

Sample

Date
----

01/01/2001
02/01/2001
03/01/2001
04/01/2001
.
.
.
.
28/12/2010
29/12/2010
30/12/2010
31/12/2010

--END---

I need to find only year ended date,
like..,


i.e.:-

31/12/2001
31/12/2002
31/12/2003
.
.
.
.
31/12/2009
31/12/2010

Give a suggestion to find this..


MAG,
Start with the new Idea..
http://mageshkumarm.blogspot.com/

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-01-13 : 02:37:20
SELECT MAX([Date]) FROM Table1 GROUP BY DATEPART(YEAR, [Date])



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

MageshkumarM
Yak Posting Veteran

61 Posts

Posted - 2011-01-13 : 03:30:16
Thnk u pesco,

MAG,
Start with the new Idea..
http://mageshkumarm.blogspot.com/
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-01-13 : 06:51:33
Pesco?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

MageshkumarM
Yak Posting Veteran

61 Posts

Posted - 2011-01-13 : 07:20:39
sorry,

thanks Mr. Peso

MAG,
Start with the new Idea..
http://mageshkumarm.blogspot.com/
Go to Top of Page
   

- Advertisement -