Skip site navigation (1) Skip section navigation (2)

Re: Selecting Fields in Union in Subquery

From: Bartosz Dmytrak <bdmytrak(at)gmail(dot)com>
To: Tom Burns <tramseyburns(at)yahoo(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Selecting Fields in Union in Subquery
Date: 2012-07-15 18:41:19
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
2012/7/13 Tom Burns <tramseyburns(at)yahoo(dot)com>

> I can no figure out the syntax for directly addressing fields (for example
> 'order by StateProvence" or "order by gTo.geo_name" instead of order by 3)

This should work ("StateProvence" not gTo.geo_name), but You should
remember to use " (quotation mark) when You use camel cased names. If not
PG will treat fields names like written in small letters.
You should do something like this:
order by "StateProvence"
order by StateProvence

> I would like to be able to filter and sort the sub-query in the parent
> query.
I don't get it, I assume You would like to sort/filter sub-query *result* in
parent query.  Then You should remember to use names of sub-query result
columns i.e
gTo.geo_name is not visilbe, but geolist."StateProvence" is visible outside
sub query


In response to


pgsql-novice by date

Next:From: Ioannis AnagnostopoulosDate: 2012-07-16 10:24:27
Subject: Re: Index slow down insertions...
Previous:From: Ioannis AnagnostopoulosDate: 2012-07-15 01:14:45
Subject: Index slow down insertions...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group