Pavel Stehule escribió:
> 2009/5/18 Alvaro Herrera :
> > Pavel Stehule escribió:
> >
> >> others tricks http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks
> >
> > There's a lot of good stuff in there ... would you care about
> > copying/moving it to wiki.postgresql.org/wiki/Snippets ?
>
> This
2009/5/18 Alvaro Herrera :
> Pavel Stehule escribió:
>
>> others tricks http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks
>
> There's a lot of good stuff in there ... would you care about
> copying/moving it to wiki.postgresql.org/wiki/Snippets ?
>
This contents is free - and if you would do
Pavel Stehule escribió:
> others tricks http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks
There's a lot of good stuff in there ... would you care about
copying/moving it to wiki.postgresql.org/wiki/Snippets ?
--
Alvaro Herrerahttp://www.CommandPrompt.com/
Po
On Mon, May 18, 2009 at 6:47 AM, Kenneth Marshall wrote:
> On Sun, May 17, 2009 at 10:04:46PM -0600, Rob Sargent wrote:
> > Can one extrapolate future performance expectations for ever-growing
> tables
> > from a given (non-trivial) data set, and if so with what curve?
> Corollary:
> > what woul
Dow!!! You’re ok! I forgot the aggregator funciont SUM!
Thanks!
De: Filip Rembiałkowski [mailto:plk.zu...@gmail.com]
Enviado el: lunes, 18 de mayo de 2009 16:54
Para: Dani Castaños
CC: pgsql-sql@postgresql.org
Asunto: [?? Probable Spam] Re: [SQL] Extract week from date
2009/5/18 Dan
2009/5/18 Dani Castaños
> Hi again,
>
> I need to extract date grouped by week from an statistics table.
>
> I was trying something like this:
>
> SELECT total_duration, EXTRACT( week from date statistics_date )
> FROM statistics_daily
> GROUP BY EXTRACT( week from date statistics_date ), total_d
Hi again,
I need to extract date grouped by week from an statistics table.
I was trying something like this:
SELECT total_duration, EXTRACT( week from date statistics_date )
FROM statistics_daily
GROUP BY EXTRACT( week from date statistics_date ), total_duration;
But it doesn't works... Neither
2009/5/18 Dani Castaños :
> Hi all,
>
> I've this query including arrays:
>
> SELECT hour[1:5], statistics_date
> FROM statistics_daily
> WHERE statistics_date = to_date( '03/01/2008', 'DD/MM/' )
>
> Result:
>
> hour | statistics_date
> +-
Thank you very much!
-Mensaje original-
De: Pavel Stehule [mailto:pavel.steh...@gmail.com]
postgres=# create or replace function sum_items(bigint[]) returns
bigint as $$ select sum($1[i])::bigint from
generate_series(array_lower($1,1), array_upper($1,1)) g(i)$$ language
sql immutable;
CR
2009/5/18 Gerardo Herzig :
> Dave Page wrote:
>> On Mon, May 18, 2009 at 1:29 PM, Gerardo Herzig wrote:
>>
>>> I think this is a good time to propose some kind of CookBook, to
>>> preserve this kind of answers.
>>
>> What, like this one?
>>
>> http://wiki.postgresql.org/wiki/Snippets
>>
>> :-)
>>
Dave Page wrote:
> On Mon, May 18, 2009 at 1:29 PM, Gerardo Herzig wrote:
>
>> I think this is a good time to propose some kind of CookBook, to
>> preserve this kind of answers.
>
> What, like this one?
>
> http://wiki.postgresql.org/wiki/Snippets
>
> :-)
>
Oops. Yeah, kind of :)
Did not see
In article <162867790905180410n670062b0ud2d7fdd0e652...@mail.gmail.com>,
Pavel Stehule writes:
> Hello
> postgres=# create or replace function sum_items(bigint[]) returns
> bigint as $$ select sum($1[i])::bigint from
> generate_series(array_lower($1,1), array_upper($1,1)) g(i)$$ language
> sql im
On Mon, May 18, 2009 at 1:29 PM, Gerardo Herzig wrote:
> I think this is a good time to propose some kind of CookBook, to
> preserve this kind of answers.
What, like this one?
http://wiki.postgresql.org/wiki/Snippets
:-)
--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
--
Sent v
I just saw a beatifull answer from Pavel, as an answer to this question:
"""
I'm just wondering if there's some way to retrieve the hour column as the
> sum of the array values... Just like this:
>
>hour| statistics_date
> +-
> 90
Hello
postgres=# create or replace function sum_items(bigint[]) returns
bigint as $$ select sum($1[i])::bigint from
generate_series(array_lower($1,1), array_upper($1,1)) g(i)$$ language
sql immutable;
CREATE FUNCTION
Time: 2,510 ms
postgres=# select sum_items(array[1,2,3,4]); sum_items
---
Hi all,
I've this query including arrays:
SELECT hour[1:5], statistics_date
FROM statistics_daily
WHERE statistics_date = to_date( '03/01/2008', 'DD/MM/' )
Result:
hour| statistics_date
+-
{1800,1800,1800,1800,1800} | 2
Hi all,
I've this query including arrays:
SELECT hour[1:5], statistics_date
FROM statistics_daily
WHERE statistics_date = to_date( '03/01/2008', 'DD/MM/' )
Result:
hour| statistics_date
+-
{1800,1800,1800,1800,1800} | 2
17 matches
Mail list logo