Re: SQL For Experts

From: Joe Bonner <jbonner_at_umich.edu>
Date: Sun, 18 Oct 1998 08:36:27 -0400
Message-ID: <3629E0CA.E680674D_at_umich.edu>


Eric,

If you could get an ordering sequence on the table you could use a max(decode(<THENEWSEQUENCE>,1,date,null))||max(decode(<thenewsequence>,1,amount,null))||' ,
'||max(decode(<thenewsequence>,2,date,null))||max(decode(<thenewsequence>,2,amount,null))

if you put this into adatabase function you could get it to find outthe maxiumu number of entries per customer there is and loop and return the entore string as a return value.

Good Luck.

Joe Bonner
University of Michigan Medical School
Ann Arbor,MI 48109-0638
jbonner_at_umich..edu
(734)647-4251

Eric Jodoin wrote:

> Hi Everyone,
>
> Do you know How I could get a Table That would do This:
>
> Select Client.NAME, Invoice.DATE, Invoice.AMMOUNT
> From CLIENT Client, INVOICE Invoice
> WHERE Client.CLIENTID = Invoice.CLIENTID
> AND CLIENTID = 1
>
> Result
>
> NAME DATE AMOUNT
> ---------------------------------------------
> BOB 2/1/1998 10.00
> BOB 2/2/1998 10.00
> BOB 2/3/1998 10.00
> BOB 12/12/1998 10.00
>
> And How Could I turn it into a result Like This
>
> ----------------------------------------------------------------------------
> --------------------------------------------------------
> BOB 2/1/1998 10.00 2/2/1998 10.00 2/3/1998
> 10.00 12/12/1998 10.00
Received on Sun Oct 18 1998 - 14:36:27 CEST

Original text of this message