pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: SQL Date Challenge
Date: Mon, 04 Jun 2001 10:31:52 -0700
Message-ID: <web-66723@davinci.ethosmedia.com> (raw)

Folks,

	Can anyone come up with a purely declarative (i.e. SQL) way to SELECT
all of the Wednesdays within a given time period?  Or is there, perhaps,
some trick of the PGSQL date parser I could use?

	I can think of a number of ways to do this procedurally, but that's
very awkward for what I need to use the information (to select all
wednesdays within the last two months for which each staff emember has
not turned in a timecard).  I'm considering using a regularly updated
reference table, but it seems like there *must* be a more elegant
solution.

	Basically, what I want is: 

SELECT ALL Wednesdays BETWEEN 5/1/01 AND 6/1/01;

	Which results in:

Wednesdays
-----------
5/2/01
5/9/01
5/16/01
5/23/01
5/30/01

	Thanks for any suggestions!

				-Josh Berkus






______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



view thread (9+ messages)  latest in thread

Message-ID: <web-66723@davinci.ethosmedia.com>
Permalink:  ../web-66723@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-66723@davinci.ethosmedia.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com
  Subject: Re: SQL Date Challenge
  In-Reply-To: <web-66723@davinci.ethosmedia.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