Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good day,
I've got a list of sales order archives with a number of versions.
How do I write my script to only look at the latest version of each sales order?
Each sales order does not have the same number of versions.
See attached test data.
Hi Rani
Please try this code
SalesTB:
LOAD * INLINE [
SOnumber, VersionNumber, Amount, Date
SO44,1,40,41607
SO46,1,50,41722
SO99,1,30,41798
SO44,4,80,34677
SO99,3,70,45368
SO77,1,50,34748
SO77,6,400,65799
];
LatestVersion:
inner keep load
SOnumber,
max(VersionNumber) as VersionNumber
resident SalesTB
group by SOnumber;
drop table LatestVersion;
TheOutput
cleveranjos , i got this idea from your post, thanks
Hi Rani
Please try this code
SalesTB:
LOAD * INLINE [
SOnumber, VersionNumber, Amount, Date
SO44,1,40,41607
SO46,1,50,41722
SO99,1,30,41798
SO44,4,80,34677
SO99,3,70,45368
SO77,1,50,34748
SO77,6,400,65799
];
LatestVersion:
inner keep load
SOnumber,
max(VersionNumber) as VersionNumber
resident SalesTB
group by SOnumber;
drop table LatestVersion;
TheOutput
cleveranjos , i got this idea from your post, thanks
Good to read that, keep in touch!