db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: Sorting with sub-select
Date Thu, 19 May 2005 15:26:01 GMT
Paul J. Lucas wrote:

> On Mon, 16 May 2005, Jack Klebanoff wrote:
>> Use an ORDER BY clause, e.g.
>     But then all the metadata for a single image isn't grouped
>     together.
>     - Paul
Hi Paul -
It sounds like a secondary sort on image id would group all the image 
metadata together in city order.  Not knowing the cardinality between 
the tables (e.g. One-to-One, One-to-Many, etc.) I can't say what he 
exact clause should be.  You probably need to specify the foreigh key 
column name of each MANY relationship to insure that related items are 
grouped.  Assuming relationships of One-to-Many between each record set  
EG:   1 CITY : MANY  image_id : MANY key_id : MANY value_id  I would 

   ...ORDER BY city, image_id, key_id, value_id

View raw message