Re: [GENERAL] Substring Problem

2008-05-13 Thread Stefan Schwarzer
COUNT(id) AS countofnumber FROM (SELECT * from downloads ) AS foo GROUP BY stryearmonth ORDER BY stryearmonth ASC btw, whats the reason for the subselect? Oh, right, looks a bit stupid like this. It's eventually being filled with something more useful, upon the user's request. It's dynamica

Re: [GENERAL] Substring Problem

2008-05-13 Thread Tino Wildenhain
[EMAIL PROTECTED] wrote: Type casting is required since 8.3, try SELECT substring(date :: varchar from 1 for 7) AS stryearmonth, ^^ sorry but this hurts and should not recommended. I think depesz approach with to_string() and the correct format string is the better so

Re: [GENERAL] Substring Problem

2008-05-13 Thread ludwig
Type casting is required since 8.3, trySELECT substring(date :: varchar from 1 for 7) AS stryearmonth, COUNT(id) AS countofnumber FROM (SELECT * from downloads ) AS foo GROUP BY stryearmonth ORDER BY stryearmonth ASCBye...LudwigHi there, it seems to work with 8.1, but not anymore with 8.3. What is

Re: [GENERAL] Substring Problem

2008-05-13 Thread Sam Mason
On Tue, May 13, 2008 at 03:26:57PM +0200, Stefan Schwarzer wrote: > SELECT substring(date from 1 for 7) AS stryearmonth, COUNT(id) AS > countofnumber FROM (SELECT * from downloads ) AS foo GROUP BY > stryearmonth ORDER BY stryearmonth ASC Another way of doing this is by using date_trunc, i.e.:

Re: [GENERAL] Substring Problem

2008-05-13 Thread hubert depesz lubaczewski
On Tue, May 13, 2008 at 03:26:57PM +0200, Stefan Schwarzer wrote: > it seems to work with 8.1, but not anymore with 8.3. What is wrong > with this substring request? Or is it some installation issue? Thanks > for any suggestion! > SELECT substring(date from 1 for 7) AS stryearmonth, COUNT(id) A