Re: Can't get my query right!!

From: Koen Van Loo <kvanloo_at_mailhost.acc.be>
Date: 1997/08/07
Message-ID: <01bca305$34f581c0$6fc809c0_at_pc_kvanloo.accnet.be>#1/1


[Quoted] This query will give you each name, with the address in lowest alphabetical order

select a.name, a.key, b.key, b.adresse
from person a, adresse b
where b.adresse = (select min(c.adresse) from adresse c where c.key = a.key)
order by a.key

Koen Van Loo


professional
e-mail: kvanloo_at_accnet.be
www: http://www.accnet.be


private
e-mail: 101717.21_at_compuserve.com
www: http://ourworld.compuserve.com/homepages/KoenVanLoo


David Fabi <dfabi_at_crim.ca> wrote in article <33E8C278.13703AF7_at_crim.ca>...
> Hello,
>
> I'm having some problems in defining my query.
>
> Here's a simplified version of my problem
>
> I have two tables
>
>
> Name Key Key Adresse
> ------------- -----------------
> John 1 1 Montreal
> Micheal 2 1 New-York
> Peter 3 1 Berlin
> 2 London
> 2 Paris
> 3 Hong Kong
>
> I wish to match each Name with one of its adresses.
>
> The resulting query should be something like
>
>
> John 1 1 Montreal
> Micheal 2 2 London
> Peter 3 3 Hong Kong
> [Quoted] [Quoted]
> It does look simple, but I don't seem to find the trick...
>
> Thanks
> --
> David Fabi
> Agent Technique, Services Informatique
> Centre de Recherche Informatique de Montréal (CRIM)
> 1801, avenue McGill Collège, bureau 800
> Montréal (QC) H3A 2N4,
> Télephone : (514) 840-1235 poste 2387
> Télécopieur : (514) 840-1244
> Internet : dfabi_at_crim.ca
>
>
>
Received on Thu Aug 07 1997 - 00:00:00 CEST

Original text of this message