Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear ALL,
I have table as below from where I want to get the min (ID) with respective to each party_id on selected period.
Table:
ID party_id amount
1002 101 100
1004 101 200
1005 105 115
2001 201 300
2002 201 225
2003 201 400
I have done as below
Load *
from Table;
Left join ( Table)
Load
Party_id
Min(ID) as MinID
resident Table
group by party_id;
I am getting below result:
Table:
ID party_id Amount MinID
1002 101 100 1002
1004 101 200 -
1005 105 115 -
2001 201 300 - ( //instead of null here we want its bill_id to be displayed)
2002 201 225 -
2003 201 400 -
Here is th issue is for IS 2001 we have only one record so its MinID is getting null (-) where we want if there is only one record then its ID should be consider as MinID. for rest of the record result is fine.
Kindly assist.
Can you post the actual script you used?
this works fine as below
Table:
load * inline [
ID,party_id,amount
1002,101,100
1004,101,200
1005,105,115
2001,201,300
2002,201,225
2003,201,400
];
Left Join(Table)
Load party_id,min(ID) as min_ID
Resident Table
Group by party_id;