loop and check logic
Posted: Thu Jul 23, 2009 11:33 pm
Hi,
We have the data in a table like this
No Column1 Column2
1 M 02-Feb-09
2 L 03-Feb-09
3 L 20-Feb-09
4 L 10-Mar-09
5 H 20-Mar-09
6 M 10-Apr-09
We need to extract the values before H and if the those values of column1 are same (in this case No 4,3 and 2 are same having value L) then extract the value of the oldest of Column2(in this case it is 03-Feb-09..which is No 2)
How can we do that.
I am sure that we do a veritical pivot and take the values as a string.
In this case Column1 values would be MLLLHM. But how to loop through the oldest L and take the date value for that.
We have the data in a table like this
No Column1 Column2
1 M 02-Feb-09
2 L 03-Feb-09
3 L 20-Feb-09
4 L 10-Mar-09
5 H 20-Mar-09
6 M 10-Apr-09
We need to extract the values before H and if the those values of column1 are same (in this case No 4,3 and 2 are same having value L) then extract the value of the oldest of Column2(in this case it is 03-Feb-09..which is No 2)
How can we do that.
I am sure that we do a veritical pivot and take the values as a string.
In this case Column1 values would be MLLLHM. But how to loop through the oldest L and take the date value for that.