Complex Query with Sage 200 function

SOLVED

I would like to do query as below: but I found that sage 200 only provide simple query & filter function.

This query is to get the TOP 1 of each group

select top 1 with ties
m.MovementID, m.ItemID, m.CostPrice from MovementBalance m
group by m.ItemID, m.CostPrice, m.MovementID
order by ROW_NUMBER() over (partition by m.itemID order by m.ItemID, m.MovementID desc)

After I query above, I want to join it with Price Book Desktop List View and display the CostPrice value per stockItem & price band. Using Join function with table name=MovementBalance will not do because it will query all of its rows, whereas I only want to select rows with the latest movementID of each stockItem.

Is there alternative to do this?

I have look into Sage 200 ObjectStore Builder to create views from the select query, but it needed join which my query don't have.

Thank you