I have a data table with sales entries. Each line is identified by a document number and an article number and has a version number (just 1, 2, 3... highest = newest).
I would now like to load only the lines with the highest version numbers for each document-number/article-number combination.
In SQL I am using the following statement to filter what I want. How would I transfer this into a QVD generation script?
SELECT TOP [Document No_]+'::'+No_ as ID, a.[Document No_], Quantity, [Shipment Date], [Amount], No_,*
FROM [Sales Line Archive] as a
join (select [Document No_]+'::'+No_ as ID, max([Version No_]) as max_version FROM [Sales Line Archive]
group by [Document No_]+'::'+No_) as b
on a.[Document No_]+'::'+a.No_ = b.ID and a.[Version No_]=b.max_version