pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Johnston <polobo@yahoo.com>
To: R. Smith <ship.quotes@gmail.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: Sorting of data from two tables
Date: Sat, 17 Sep 2011 09:56:46 -0400
Message-ID: <27CF61B6-2101-4FD7-91BD-DC82C59E9015@yahoo.com> (raw)
In-Reply-To: <CADuTMYBbypDgCT6nnFoJwT2JuHdKAiAYhR2inAWf6LkY7xMi3Q@mail.gmail.com>
References: <CADuTMYBbypDgCT6nnFoJwT2JuHdKAiAYhR2inAWf6LkY7xMi3Q@mail.gmail.com>

On Sep 17, 2011, at 9:32, "R. Smith" <ship.quotes@gmail.com> wrote:

> 
> What I want to do is do a query joining table A with B and sorting
> firstly on a field in Table A then on several fields in Table B.
> 
> 
> SELECT a.gdn_gdn, a.gdn_custref, a.gdn_date, a.gdn_address_name,
> a.gdn_method, b.gdn_stockref, b.gdn_row, b.gdn_bay, b.gdn_shelf
> FROM a
> LEFT JOIN b
> ON a.gdn_gdn = b.gdn_gdn
> ORDER BY a.gdn_method,b.gdn_row, b.gdn_bay, b.gdn_shelf
> 

It would help if you gave an example comparing the above query results with your desired results.  It would also help if you actually provided a detailed description of you goal instead of the generic one quoted above.  Given your stated need the query does exactly what you requested.

David J.=

view thread (4+ messages)  latest in thread

Message-ID: <27CF61B6-2101-4FD7-91BD-DC82C59E9015@yahoo.com>
Permalink:  ../27CF61B6-2101-4FD7-91BD-DC82C59E9015@yahoo.com/
Also on:    postgresql.org/message-id/27CF61B6-2101-4FD7-91BD-DC82C59E9015@yahoo.com

 · 

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: polobo@yahoo.com, ship.quotes@gmail.com
  Subject: Re: Sorting of data from two tables
  In-Reply-To: <27CF61B6-2101-4FD7-91BD-DC82C59E9015@yahoo.com>

* 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