From: John Fabiani <johnf@jfcomputer.com>
To: pgsql-sql@postgresql.org
Subject: Re: using a generated series in function
Date: Sat, 17 Dec 2011 08:50:52 -0800
Message-ID: <101859121.8q3HjkjhPI@linux-12> (raw)
In-Reply-To: <201112160731.41028.adrian.klaver@gmail.com>
References: <-6224470694062641569@unknownmsgid>
<1424284.aaP0Qsvkam@linux-12>
<201112160731.41028.adrian.klaver@gmail.com>
As always I respect your insights - Adrian. I do understand what I did wrong
in my first attempt at getting my statement to work. But it is either over my
head or there is something missing. Where is the "from" in
select now()?
I have been using similar SQL statements for years. I never questioned why
there was not a 'from' until this list noted that I was missing a 'From'. I
then went to the postgres site to read. That's how I determined what I had
done incorrectly.
I hope this is not one of those things like javascript where all white space
is ignored unless it's not! I hate that language! It appears that everything
needs a 'From' in SQL (reading the doc's) and the above statement is missing a
'From'!
As always everyone - thanks for your help!
Johnf
On Friday, December 16, 2011 07:31:40 AM Adrian Klaver wrote:
> FROM Clause
> "select
>
> A sub-SELECT can appear in the FROM clause. This acts as though its
> output were created as a temporary table for the duration of this single
> SELECT command. Note that the sub-SELECT must be surrounded by parentheses,
> and an alias must be provided for it. A VALUES command can also be used
> here. "
>
> >
> >
> > select foo.week_date, xchromasun._chromasun_getqtyordered(303,
> > foo.week_date) as week_qty from
> >
> > (select ((date_trunc('week', '2011-11-20'::date )::date) + (i+6)) as
> >
> > week_date from generate_series(0,84,7)
> >
> > i ) as foo
> >
> >
> > The above works!
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: johnf@jfcomputer.com
Subject: Re: using a generated series in function
In-Reply-To: <101859121.8q3HjkjhPI@linux-12>
* 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