From: jeff@dnuk.com
To: pgsql-sql@postgresql.org
Subject: How to specify the beginning of the month in Postgres SQL syntax?
Date: Sun, 07 Dec 2003 16:16:44 +0000
Message-ID: <t6k6tv8unr1dm7kpeb275ca0t9in2i910h@4ax.com> (raw)
Hello,
I need to create a view in Postgres that has a where clause of the
date < beginning of month.
i.e.:
SELECT supplier_number, Sum(amount) AS due
FROM purchase_orders
WHERE date < '2003-12-1' AND paid = 0
GROUP BY supplier_number
ORDER BY supplier_number ASC
As you can see, I've specified the 1st of December this year as the
where clause. What I want is an SQL statement that automatically
generates the first of the month. How do I do this?
Thanks.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jeff@dnuk.com
Subject: Re: How to specify the beginning of the month in Postgres SQL syntax?
In-Reply-To: <t6k6tv8unr1dm7kpeb275ca0t9in2i910h@4ax.com>
References: <t6k6tv8unr1dm7kpeb275ca0t9in2i910h@4ax.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox