Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / April 2006

Tip: Looking for answers? Try searching our database.

Year only data from daily dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Web learner - 05 Apr 2006 02:33 GMT
I have daily data from year 1995 to 2004. The following query
SELECT [obsDate] FROM [tblObs]
returns 3653 datevalue records for each day.

1995-01-01 00:00:00
1995-01-02 00:00:00
1995-01-03 00:00:00
----------------------
----------------------
2004-12-29 00:00:00
2004-12-30 00:00:00
2004-12-31 00:00:00

I just want a recordset having years. That means with only 10 records as
follow.

1995
1996
1997
-----
-----
2004

What should be the SQL query?

I do not know anything about objectDataSource of ADO.NET. Is it worthwhile
or better for this kind of problem?

Thanks for reading this ...

Regds,

Web learner
Tom Moreau - 05 Apr 2006 02:39 GMT
Try:

select distinct
   Year (obsDate) as 'Year'
from
   tblObs

Signature

  Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON   Canada
.

I have daily data from year 1995 to 2004. The following query
SELECT [obsDate] FROM [tblObs]
returns 3653 datevalue records for each day.

1995-01-01 00:00:00
1995-01-02 00:00:00
1995-01-03 00:00:00
----------------------
----------------------
2004-12-29 00:00:00
2004-12-30 00:00:00
2004-12-31 00:00:00

I just want a recordset having years. That means with only 10 records as
follow.

1995
1996
1997
-----
-----
2004

What should be the SQL query?

I do not know anything about objectDataSource of ADO.NET. Is it worthwhile
or better for this kind of problem?

Thanks for reading this ...

Regds,

Web learner
Web learner - 05 Apr 2006 02:47 GMT
Yes, it worked. This is what I wanted for the moment.

Thanks......

> Try:
>
[quoted text clipped - 36 lines]
>
> Web learner

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.