Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1]) by hub.org (8.8.8/8.7.5) with SMTP id PAA21838 for ; Wed, 12 Aug 1998 15:34:10 -0400 (EDT) Received: from France.Sun.COM ([129.157.188.1]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id MAA18156; Wed, 12 Aug 1998 12:33:30 -0700 Received: from sybille.France.Sun.COM by France.Sun.COM (SMI-8.6/SMI-SVR4-sd.fkk200) id VAA00769; Wed, 12 Aug 1998 21:33:28 +0200 Received: from dimitri by sybille.France.Sun.COM (SMI-8.6/SMI-SVR4) id VAA10952; Wed, 12 Aug 1998 21:33:19 +0200 From: Dimitri Reply-To: dimitri@France.Sun.COM To: Walt Bigelow Subject: Re: [SQL] returning the current date in a SQL query Date: Wed, 12 Aug 1998 21:29:49 +0200 X-Mailer: KMail [version 0.7.9] Content-Type: text/plain References: Cc: pgsql-sql@postgreSQL.org MIME-Version: 1.0 Message-Id: <9808122134240I.00535@dimitri> Content-Transfer-Encoding: quoted-printable I think you have to play with UNION: select ... , project_date from tblprojects where title not in ( '[unknown= ]', 'pending' ) UNION ALL select ... , 'now'::datetime from tblprojects where title =3D '[unknown]' UNION ALL select ... , 'now'::datetime from tblprojects where title =3D 'pending'; It'll be more elegant if you create a VIEW with this query, but for the moment UNION is not available in VIEWs... Hope it helps... (dim) On Wed, 12 Aug 1998, you wrote: >I have a table (tblprojects) that stores the current projects in our=0D >facility. I want to be able to have two of the records "[unknown]" and=0D >"pending" (the project titles) always return the current date- basicall= y=0D >overwriting the date field stored in the table.=0D >=0D >I need this because I am sorting the projects in a 'combo box' (in MS=0D >Access) by dates, for example today, this week, last week, this month,=0D >last month, etc. But I want the "[unknown]" and "pending" projects to=0D >ALWAYS appear in the result of the query.=0D >=0D >Is this possible? Do I have to set the date field of the table to=0D >something like a function?=0D >=0D >Thanks in advance for any help!=0D >=0D >Walt=0D >=0D >P.S. my date field is of type "datetime" -- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Dimitri KRAVTCHUK (dim) Sun Microsystems Benchmark Engineer France=20 dimitri@France.Sun.COM =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D