From: | John Fabiani <johnf(at)jfcomputer(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: using a generated series in function |
Date: | 2011-12-17 16:50:52 |
Message-ID: | 101859121.8q3HjkjhPI@linux-12 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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!
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2011-12-17 18:09:31 | Re: using a generated series in function |
Previous Message | Filip Rembiałkowski | 2011-12-17 15:16:07 | Re: Natural sort order |