Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load only rows with min value

Hi guys,

I'm trying to load "min values" from a table. I have redundant rows but I want only the row's which have the min Amount.

Example:

  ID, Amount

    1, 5

    1, 2

    2, 3

    2, 8

    3, 9

In this Example I want only back...

1,2

2,3

3,9

But I don't know to handle this.

Thank you

20 Replies
Kushal_Chawda

Data:

LOAD

ID

DateOne

SETDate

DateTwo,

floor(DateTwo)- floor(DateOne) as Diff,

Amount

FROM table;

New:

LOAD ID,

           DateOne,

           FirstSortedValue(DateTwo,Diff) as DateTwo,

          Firstsortedvalue(Amount,Diff) as Amount

Resident Data

group by ID,DateOne;

drop table Data;