You can use the below query to get the week from Sunday.
select ceil(((now()::date -((CAST(EXTRACT (year FROM now()) as
text)||'-01-04')::date - CAST
(EXTRACT (isodow FROM (CAST(EXTRACT (year FROM
now()) as
text)||'-01-04')::date)
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
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
> -Ursprungligt meddelande-
> Från: Janning Vygen [mailto:[EMAIL PROTECTED]
> Skickat: den 7 november 2005 15:18
> Till: pgsql-sql@postgresql.org
> Kopia: Robert Blixt
> Ämne: Re: [SQL] Extract week from date, start with sunday
>
> Am Montag, 7. November 2005 14
am 07.11.2005, um 14:47:35 +0100 mailte Robert Blixt folgendes:
>
> Hi,
>
>
> I am currently extracting my weeks from a date like this..
>
> SELECT INTO extractweek EXTRACT( week FROM ldate );
>
> This works fine, except that this assumes (according
> to ISO standard) that weeks starts with
Hi,
I am currently extracting my weeks from a date like this..
SELECT INTO extractweek EXTRACT( week FROM ldate );
This works fine, except that this assumes (according
to ISO standard) that weeks starts with Monday.
I need the weeks to start with Sunday instead, otherwise
I will not get the