t == t...@sss.pgh.pa.us writes:
t> Brandon Metcalf writes:
t> > I tried moving the last group of WHERE, GROUP BY, and ORDER BY before
t> > the UNION with the query it belongs to, but that results in a
t> > different syntax error.
t> I think that's probably what you want to do. What you're
M == matthew.hart...@krcc.on.ca writes:
M> > > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
M> > > ow...@postgresql.org] On Behalf Of Brandon Metcalf
M> > > Sent: Friday, July 10, 2009 12:16 PM
M> >
M> > Change it to this:
M> Sorry, I forgot that you need to split the GRO
Brandon Metcalf writes:
> I tried moving the last group of WHERE, GROUP BY, and ORDER BY before
> the UNION with the query it belongs to, but that results in a
> different syntax error.
I think that's probably what you want to do. What you're missing is
you need parentheses to put an ORDER BY in
> > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
> > ow...@postgresql.org] On Behalf Of Brandon Metcalf
> > Sent: Friday, July 10, 2009 12:16 PM
>
> Change it to this:
Sorry, I forgot that you need to split the GROUP BY clause as well in a
similar manner to the WHERE clause. An
> -Original Message-
> From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
> ow...@postgresql.org] On Behalf Of Brandon Metcalf
> Sent: Friday, July 10, 2009 12:16 PM
Change it to this:
> SELECT t.name AS machine_type_name,
> j.workorder,
>
Is the following even possible? I keep getting a syntax error at the
last WHERE:
ERROR: syntax error at or near "WHERE"
LINE 20: WHERE p.part_id=379 AND t.machine_type_id=1
The SQL is
SELECT t.name AS machine_type_name,
j.workorder,
round(sum(EXTRACT