Liam Delahunty: Home | Tips | Web | Contact |
---|
Recommended laptop
under £500. Think I deserve a present? See my Amazon Wish List |
MySQL - Day Of YearDAYOFYEARDAYOFYEAR can be used to limit the result set so that you may compare various years data with the data so far this year. In my oninesales e-commerce application I use the following for a snap-shot report.
SELECT
Gaining results such as: +------+--------+----------+-----------+---------+---------------+ | YYYY | Orders | Grand | AvgIncVat | AvgPost | AvgTotalPrice | +------+--------+----------+-----------+---------+---------------+ | 2004 | 94 | 4359.89 | 42.91 | 3.47 | 46.38 | | 2005 | 549 | 13308.57 | 18.97 | 5.27 | 24.24 | | 2006 | 754 | 19569.59 | 20.20 | 5.75 | 25.95 | +------+--------+----------+-----------+---------+---------------+ Share this! |