Re: Group by YEAR in date
| From: | 1LT John W. Holmes | Date: | Mon, 28 Oct 2002 14:17:09 +0000 |
| Subject: | Re: Group by YEAR in date | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121695@lists.php.net to get a copy of this message | ||
> I have a table (postgres), with a date field (yyyy-mm-dd). How do I group
by
> year?
>
> 'select sum(profit) from loan group by apply_date' would group by the DAY,
> not year.
SELECT SUM(profit) FROM load GROUP BY YEAR(apply_date)
---John Holmes...