Best way to convert rows to column?
Date: 27 Aug 2002 05:38:15 -0700
Message-ID: <a618084.0208270438.9f6a4fd_at_posting.google.com>
Assume two tables EMP(EMP_ID,etc) and Childern(EMP_ID, Child_ID, etc)
with a Master/Detail relation, meaning
Result expected:
EMP_ID Child_1 Child_2 Child_3 Child_4 Child_5
one employee can have 0 upto five n childern( say limited to 5). Now
want to have a sql generate the output like the following, Any
suggestions will be very appreciated.
EMP TABLE DATA Child table Data
101 101 1001
102 101 1002
... 102 1004
102 1005
102 1006
...
101 1001 1002 NULL NULL NULL
102 1004 1005 1006 NULL NULL
Received on Tue Aug 27 2002 - 14:38:15 CEST