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.
loop and check logic
Moderators: chulett, rschirm, roy
Re: loop and check logic
Hi,
I don't know why to specify "before H."
you can take the sort satge on column1 and column2 in descndin order. hen you take remove duplicate stage and mention the key column1 and pass the last record( here yu get the oldest date record).
Here you have the column 1 - M records also there.It applicable to both.
if you get any problem sort data on column2 the convert to date type and do sort.
Thanks
I don't know why to specify "before H."
you can take the sort satge on column1 and column2 in descndin order. hen you take remove duplicate stage and mention the key column1 and pass the last record( here yu get the oldest date record).
Here you have the column 1 - M records also there.It applicable to both.
if you get any problem sort data on column2 the convert to date type and do sort.
Thanks
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
1. Filter out the records you dont want like H and records after that.
2. Sort and then pass only those records having the next records column 1 is same as column 1. you may also need to keep track of count and pass only those records having count =1
2. Sort and then pass only those records having the next records column 1 is same as column 1. you may also need to keep track of count and pass only those records having count =1
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
Genius may have its limitations, but stupidity is not thus handicapped.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: