Re: Sorting of data from two tables - Mailing list pgsql-sql

From David Johnston
Subject Re: Sorting of data from two tables
Date
Msg-id 27CF61B6-2101-4FD7-91BD-DC82C59E9015@yahoo.com
Whole thread Raw
In response to Sorting of data from two tables  ("R. Smith" <ship.quotes@gmail.com>)
Responses Re: Sorting of data from two tables
List pgsql-sql
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.

pgsql-sql by date:

Previous
From: "R. Smith"
Date:
Subject: Sorting of data from two tables
Next
From: Andreas
Date:
Subject: insert or update within transaction