Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

DB2 SQL merge two rows into one row

$
0
0
Hi,
I have a table with the following data:

TABLEA
CLI_ID ADR_TYP ADDRS CHNG_DATE PHONE
===================================
A1 PR HYD 2010-01-01 123344
A1 PR MAS 2010-05-01 123EER
A1 M HYD1 2010-02-01 1234465
A1 M HYD2 2010-01-01 1234467

I want to see the result data as follows:
CLI_ID PR_ADR_TYP ADDR PR_CHNG_DATE M_ADR_TYP M_CHNG_DATE
================================================== ======
A1 PR MAS 2010-05-01 M 2010-02-01

Note: the date is latest date for the each ADR_TYP.

Please help me how to achieve this using DB2 SQL.

Viewing all articles
Browse latest Browse all 13329

Trending Articles