pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Fenbers <mark.fenbers@noaa.gov>
To: pgsql-sql@postgresql.org
Subject: Fun with Dates
Date: Mon, 29 Oct 2012 18:38:46 -0400
Message-ID: <508F0576.4020404@noaa.gov> (raw)

This is a multi-part message in MIME format.
--------------090405050005010407060402
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFCC" text="#000000">
    Greetings,<br>
    <br>
    I want to be able to select all data going back to the beginning of
    the current month.&nbsp; The following portion of an SQL does NOT work,
    but more or less describes what I want...<br>
    <br>
    ... WHERE obstime &gt;= NOW() - INTERVAL (SELECT EXTRACT (DAY FROM
    NOW() ) ) + ' days'<br>
    <br>
    In other words, if today is the 29th of the month, I want to select
    data that is within 29 days old... WHERE obstime &gt;= NOW() -
    INTERVAL '29 days'<br>
    <br>
    How do I craft a query to do use a variable day of the month?<br>
    <br>
    Mark<br>
  </body>
</html>

--------------090405050005010407060402
Content-Type: text/x-vcard; charset=utf-8;
 name="mark_fenbers.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="mark_fenbers.vcf"

begin:vcard
fn:Mark Fenbers
n:Fenbers;Mark
org:Ohio River Forecast Center;Hydrometeorological Analysis & Support Unit
adr:1901 South OH-134;;National Weather Service;Wilmington;OH;45177-9708;USA
email;internet:Mark.Fenbers@noaa.gov
title:Senior Meteorologist
tel;work:937-383-0430
tel;fax:937-383-0033
url:weather.gov/ohrfc
version:2.1
end:vcard


--------------090405050005010407060402--




Attachments:

  [text/x-vcard] mark_fenbers.vcf (345B, ../508F0576.4020404@noaa.gov/2-mark_fenbers.vcf)
  download | inline:
begin:vcard
fn:Mark Fenbers
n:Fenbers;Mark
org:Ohio River Forecast Center;Hydrometeorological Analysis & Support Unit
adr:1901 South OH-134;;National Weather Service;Wilmington;OH;45177-9708;USA
email;internet:Mark.Fenbers@noaa.gov
title:Senior Meteorologist
tel;work:937-383-0430
tel;fax:937-383-0033
url:weather.gov/ohrfc
version:2.1
end:vcard

view thread (3+ messages)  latest in thread

Message-ID: <508F0576.4020404@noaa.gov>
Permalink:  ../508F0576.4020404@noaa.gov/
Also on:    postgresql.org/message-id/508F0576.4020404@noaa.gov

 · 

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: mark.fenbers@noaa.gov
  Subject: Re: Fun with Dates
  In-Reply-To: <508F0576.4020404@noaa.gov>

* 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