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

Script

I Have a table  in the following format:

FirstName,LastName , Address,SSN

I want to take a resident of the above table and get the data only where SSN is maximum??????

Please help

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

tempTable:
LOAD * INLINE [
    FirstName, LastName, Address, SSN
    a, a, a, 1
    b, b, b, 2
    c, c, c, 3
    d, d, d, 3
];

tempTable1: //This table loads only one entry with max SSN
First 1 Load
FirstName as tempFirstName,
LastName as tempLastName,
Address as tempAddress,
SSN as tempSSN
Resident tempTable order by SSN desc;

LET maxSSN=FieldValue('tempSSN',1); //Getting the maxSSN

finalTable:
NoConcatenate  //Make sure it does not concatenate with tempTable
Load *
resident tempTable where SSN=$(maxSSN);

Drop table tempTable;
Drop table tempTable1;

Is that what you are looking for?

Regards,

Xue Bin

View solution in original post

2 Replies
Not applicable
Author

Hi,

tempTable:
LOAD * INLINE [
    FirstName, LastName, Address, SSN
    a, a, a, 1
    b, b, b, 2
    c, c, c, 3
    d, d, d, 3
];

tempTable1: //This table loads only one entry with max SSN
First 1 Load
FirstName as tempFirstName,
LastName as tempLastName,
Address as tempAddress,
SSN as tempSSN
Resident tempTable order by SSN desc;

LET maxSSN=FieldValue('tempSSN',1); //Getting the maxSSN

finalTable:
NoConcatenate  //Make sure it does not concatenate with tempTable
Load *
resident tempTable where SSN=$(maxSSN);

Drop table tempTable;
Drop table tempTable1;

Is that what you are looking for?

Regards,

Xue Bin

Not applicable
Author

Hi

thanks a lot