X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 48081D1B4CC for ; Wed, 10 Dec 2003 14:23:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 50662-05 for ; Wed, 10 Dec 2003 10:23:08 -0400 (AST) Received: from mail.dhs-club.com (mail.dhs-club.com [63.124.98.242]) by svr1.postgresql.org (Postfix) with ESMTP id 6B8C0D1B439 for ; Wed, 10 Dec 2003 10:22:59 -0400 (AST) Received: from dhs-club.com ([192.168.0.3]) (authenticated) by mail.dhs-club.com (8.11.6/8.11.3) with ESMTP id hBAEMmK27353; Wed, 10 Dec 2003 06:22:49 -0800 Message-ID: <3FD72BAC.90CC3C38@dhs-club.com> Date: Wed, 10 Dec 2003 09:20:28 -0500 From: DHS Webmaster Organization: The DHS Club X-Mailer: Mozilla 4.79 [en]C-CCK-MCD compaq (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: jeff@dnuk.com, pgsql-sql@postgresql.org Subject: first of month Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.2 tagged_above=0.0 required=5.0 tests=BAYES_30, RCVD_IN_SBL, UPPERCASE_25_50, USER_AGENT_MOZILLA_XM X-Spam-Level: * X-Archive-Number: 200312/83 X-Sequence-Number: 16249 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!