Would this do it?

SELECT TOP 1 pub_date
ORDER BY pub_date ASC

SELECT TOP 1 pub_date
ORDER BY pub_date DESC

best,  paul

At 09:14 AM 1/15/03 -0800, you wrote:
>I have a query that returns all of the publication dates of stories in a
>database.  Currently, it returns 18,000 rows.  Eventually, there will be
>100,000 stories in the database.  Returning a query with that many records
>and manipulating the dates (what I was thinking of doing) seems incrediblly
>inefficient.
>
>I would like to extract in a query the following information ...
>
>first year of published stories
>         first month of that first year
>                 first day of that first month of that first year
>
>last year of published stories
>         last month of that last year
>                 last day of that last month of that last year
>
>I tried doing something like
>
>SELECT Max(year(pub_date) as last_year
>FROM table
>
>That didn't give me the results I expected.
>
>This is in MS SQL and I'm running the query as a stored procedure.
>
>Suggestions?
>
>Also, any good Web sites for programming transact-SQL?  Especially something
>that, given my present need, will cover date manipulation.  I've searched
>and haven't been able to find.
>
>H.
>
>
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Howard Owens
>Internet Operations Coordinator
>InsideVC.com/Ventura County Star
>[EMAIL PROTECTED]
>AIM: GoCatGo1956
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to