first of month

Поиск
Список
Период
Сортировка
От DHS Webmaster
Тема first of month
Дата
Msg-id 3FD72BAC.90CC3C38@dhs-club.com
обсуждение исходный текст
Список pgsql-sql
Jeff,
We use a simple function that can be called in any query, like so:
SELECT * FROM table WHERE column < first_of_month();

-- Function: public.first_of_month()
CREATE FUNCTION public.first_of_month() RETURNS date AS '
DECLARE stamp DATE;

BEGIN
SELECT INTO stamp CAST(date_trunc(''month'',now())AS DATE);
return stamp;
END;'  LANGUAGE 'plpgsql' STABLE;

-- 
Bill MacArthur
Webmaster
The DHS Club, Inc.
The Best Is Yet To Come!


В списке pgsql-sql по дате отправления:

Предыдущее
От: Chris Travers
Дата:
Сообщение: How to completely move a table to another schema?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to specify the beginning of the month in Postgres SQL syntax?