RE: [PHP] Group by YEAR in date

2002-10-29 Thread Faisal Abdullah
Thanks guys.
It worked.

Regards,
Faisal

 -Original Message-
 From: 1LT John W. Holmes [mailto:holmes072000;charter.net]
 Sent: Monday, October 28, 2002 10:17 PM
 To: Faisal Abdullah; [EMAIL PROTECTED]
 Subject: Re: [PHP] Group by YEAR in date
 
 
  I have a table (postgres), with a date field (-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...
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

__


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Group by YEAR in date

2002-10-28 Thread Marek Kilimajer
In mysql, I would need to select an extra column
SELECT SUM(profit), YEAR(apply_date) AS year FROM loan GROUP BY year

Faisal Abdullah wrote:


Hi people,

I have a table (postgres), with a date field (-mm-dd). How do I group by
year?

'select sum(profit) from loan group by apply_date' would group by the DAY,
not year.
Thanks.

Regards,
Faisal

__


 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Group by YEAR in date

2002-10-28 Thread 1LT John W. Holmes
 I have a table (postgres), with a date field (-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...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php