Re: Sorting of data from two tables

From: David Johnston <polobo(at)yahoo(dot)com>
To: "R(dot) Smith" <ship(dot)quotes(at)gmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Sorting of data from two tables
Date: 2011-09-17 13:56:46
Message-ID: 27CF61B6-2101-4FD7-91BD-DC82C59E9015@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sep 17, 2011, at 9:32, "R. Smith" <ship(dot)quotes(at)gmail(dot)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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas 2011-09-17 14:52:55 insert or update within transaction
Previous Message R. Smith 2011-09-17 13:32:28 Sorting of data from two tables