Re: SQL-Question
Date: 1996/07/03
Message-ID: <4renvo$16j_at_gateway.marconi.ca>#1/1
In article <31DA7E4C.69E6_at_zdf.de>, pelz_at_zdf.de says...
>
>Hi SQL-world,
>I have a simple SQL-question perhaps with an simple SQL-answer.
>There are one Master- and three Slave-Tables. There is no connection
>between these Slave-Tables. The Slave-Tables can contain different
>counts of Datasets according to the Master.
>
>select master.titel, slave1.name, slave2.address, slave3.holidaylocation
>from master, slave1, slave2, slave3
>Where master.id=slave1.idmaster(+)
> and master.id=slave2.idmaster(+)
> and master.id=slave3.idmaster(+);
>
>gives me:
>
>TITEL NAME ADDRESS HOLIDAYLOCATION
>-------------- ---------------- -------------------
>-----------------------
>a pelz wiesbaden mallorca
>a pelz wiesbaden elba
>a pelz wiesbaden naxos
>b ZDF mainz
>b ZDF berlin
>
>etc....
>
>but I like to have:
>
>TITEL NAME ADDRESS HOLIDAYLOCATION
>-------------- ---------------- -------------------
>-----------------------
>a pelz wiesbaden mallorca
>a elba
>a naxos
>b ZDF mainz
>b berlin
>
>etc....
>
>
>Is there anybody, who can tell me, which SQL-Statement will be mine??
>
>Thanks a lot,
>
>Juergen Pelz.
>
>email: pelz_at_zdf.de
>tel: 49 - 6131 - 703608
Using a BREAK command prior to your Select statement will do. Unfortunately, you can not Break on multiple columns.
example1:
BREAK ON NAME
select master.titel, slave1.name ....
....
output:
TITEL NAME ADDRESS HOLIDAYLOCATION
-------------- ---------------- ------------------- ----------------------- a pelz wiesbaden mallorca a wieshaden elba a wieshaden naxos b ZDF mainz b berlin
example2: (workaround for multiple columns)
BREAK ON name_and_address
select master.titel,slave1.name||slave1.adddress name_and_address,
slave3.holidaylocation, ....
from .....
output:
TITEL NAME_AND_ADDRESS HOLIDAYLOCATION -------------- ------------------------------------ ----------------------- a pelz wiesbaden mallorca a elba a naxos b ZDF mainz b ZDF berlin