Reply to Re: selecting max and min year

Your name:

Reply:


Posted by --CELKO-- on 03/15/07 22:41

SELECT DATEPART(yy, MAX (foo_date)) AS max_year,
DATEPART(yy, MIN (foo_date)) AS min_year
FROM Foobar;

It is important not to put the DATEPART() inside the aggregate
functions. It is easy to find the min and max on a column via indexes
or statistics tables. Once you put a funciton inside an aggregate
function, you cannot use these tools and have to do a table scan.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация