Re: Transposition of data, SQL enigma

From: Andrew Joseph Esposito <aje_at_lys.vnet.net>
Date: 1996/10/08
Message-ID: <53ed1e$3jl_at_ralph.vnet.net>#1/1


Andrew Joseph Esposito (aje_at_vnet.net) wrote:
: I have a table laid out in the following (simplified) fashion:
: [...]
: If you know, a quick note to aje_at_vnet.net would be extremely appreciated!
: I'm working at First Union National Bank right now and could really use
: some help.

I thought I'd post the answer for anyone who was wondering how such a thing is done ... it hit me like a freight train once I calmed down.

It's actually just joining the table to itself, several times...

SELECT m1.acctnum as a, m1.abal as abal9505, m2.abal as abal9506,

       m3.abal as abal9507, ...
FROM monthly m1, monthly m2, monthly m3, ... WHERE m1.yr_mo = '9505' AND m2.yr_mo = '9506' AND m3.yr_mo = '9507' AND ...   AND m1.acctnum = m2.acctnum AND m2.acctnum = m3.acctnum AND m3.acctnum = ... ;

Thanks for reading these anyway.

Have a GREAT DAY!

--
Andrew Joseph Esposito
aje_at_vnet.net
http://www.vnet.net/users/aje
Received on Tue Oct 08 1996 - 00:00:00 CEST

Original text of this message