Re: [SQL] returning the current date in a SQL query

From: Walt Bigelow <walt(at)stimpy(dot)com>
To: Dimitri <dimitri(at)France(dot)Sun(dot)COM>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] returning the current date in a SQL query
Date: 1998-08-12 21:07:45
Message-ID: Pine.LNX.3.96.980812140225.18245B-100000@alice.stimpy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Cool, thanks for that information. This was not exactly what I was
intending, but I can modify my query to do this. Basically I just wanted
to ALWAYS see '[unknown]' and 'pending' on a result from a query that
simply limited the range of dates in tblproject. But this does it
perfectly / and better!

Thanks again!
-Walt

On Wed, 12 Aug 1998, Dimitri wrote:

> 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 = '[unknown]'
> UNION ALL
> select ... , 'now'::datetime from tblprojects where title = '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
> >facility. I want to be able to have two of the records "[unknown]" and
> >"pending" (the project titles) always return the current date- basically
> >overwriting the date field stored in the table.
> >
> >I need this because I am sorting the projects in a 'combo box' (in MS
> >Access) by dates, for example today, this week, last week, this month,
> >last month, etc. But I want the "[unknown]" and "pending" projects to
> >ALWAYS appear in the result of the query.
> >
> >Is this possible? Do I have to set the date field of the table to
> >something like a function?
> >
> >Thanks in advance for any help!
> >
> >Walt
> >
> >P.S. my date field is of type "datetime"
> --
> =====================================================
> Dimitri KRAVTCHUK (dim) Sun Microsystems
> Benchmark Engineer France
> dimitri(at)France(dot)Sun(dot)COM
> =====================================================
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Karin Probost 1998-08-14 07:23:48 test subscribed
Previous Message Dirk Elmendorf 1998-08-12 20:31:29 Cursors in Functions