need logic

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
pattemk
Participant
Posts: 84
Joined: Wed May 16, 2007 4:04 pm

need logic

Post by pattemk »

hi,

i have three columns, as below

claim_id(varchar) service_number(varchar) adjustment_type(varchar)
--
123 1 11
123 2 12
123 4 13
123 3 13
456 56 12
567 10 11
567 67 11
847 3 11
902 4 11
902 4 12
902 4 13
420 7 13
420 4 13

i need to get the all the rows whose adjustment_type is 13, if no 13 in a particual claim_id then 12 else 11.

the output should look like below:-
claim_id service_line adjustment_type
123 4 13
123 3 13
456 56 12
567 10 11
567 67 11
847 3 11
902 4 13
420 7 13
420 4 13

plz help

tahnk you
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Limit your data to adjustment_type GE 11 then order the remaining data by ascending claim_id, descending adjustment type and ascending service_number, then take the first unique claim_id and service_number combination.
Post Reply