Re: Substring Problem

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: ludwig(at)kni-online(dot)de
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Substring Problem
Date: 2008-05-13 14:45:03
Message-ID: 4829A96F.4060207@wildenhain.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

ludwig(at)kni-online(dot)de 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 solution. (think of datetyle oddities) - one of the reasons
I believe most of the implicit casts have gone ayway.

> COUNT(id) AS countofnumber FROM (SELECT * from downloads ) AS foo GROUP
> BY stryearmonth ORDER BY stryearmonth ASC

btw, whats the reason for the subselect?

T.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-05-13 14:47:40 Re: Making sure \timing is on
Previous Message Joshua D. Drake 2008-05-13 14:39:07 Re: PG -v- MySQL