Question

Could you help me one case, below

After Tranpose the table i get result as like this:

Lno             OID     ConnectedDate
100000224   34931   Feb  7 201,Feb  7 201,Feb  8 201,Feb  8 201,Feb  4 201
100001489   9156    Jun 23 201,Jun 24 201,Jun 25 201,Jun 25 201,Oct 29 201,Oct 29 201
100002153   31514   Oct  5 201
100002740   32367   Sep 14 201,Sep 14 201,Oct 21 201,Sep 15 201,Sep 15 201,Sep 16 201
100004774   31558   May 19 201,May 19 201,May 20 201,May 20 201,Jun  2 201
100004935   5857    Sep  1 201,Sep  1 201,Sep  3 201,Sep  3 201,Sep 29 201,Aug 31 201,Sep 22 201
100004935   31684   Jun 16 201,Jun 17 201,Jun 17 201,Jun 19 201
100004983   33942   Dec 30 201,Dec 30 201,Dec 27 201,Dec 29 201,Dec 28 201
100005055   32347   Sep 14 201,Sep 13 201,Sep 13 201,Oct  1 201,Oct  5 201,Oct 20 201,Nov 17 201,Sep 15 201,Sep 16 201,Dec  4 201
100006146   31481   Apr 30 201,Apr 30 201,May  3 201,May  4 201,May  4 201,Jun  3 201,Jun  4 201,Jun  5 201,Jun  7 201,Jun 12 201

But i want output like this:

LID             OID     ConnectedDate1  ConnectedDate2  ConnectedDate3  ConnectedDate4
100000224   34931   Feb  7 201      Feb  7 201      Feb  8 201      Feb  8 201 
100001489   9156    Jun 23 201      Jun 24 201      Jun 25 201      Jun 25 201
100002153   31514   Oct  5 201
100002740   32367   Sep 14 201       Sep 14 201     Oct 21 201      Sep 15 201
100004774   31558   May 19 201       May 19 201      May 20 201

Plz help me Thanks in advance

No correct solution

OTHER TIPS

You need the PIVOT command. To give more details, you'd need to provide your query

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top