My SQL code is below. I have a table 'Document Instance' joined to various other tables. In my system, a new document instance is created every time a new version of the document is released or someone makes a changes to settings. As a result, there will be multiple instances of the same document version.
I have my code working fine for displaying everything, but I only want to display the Min instance for each document version. So as an example, I will have DocumentId 1 which will have multiple versions 1. 1.1 1.2 etc and each version may have multiple instances. I only want the minimum instance for each version of each document.
I am not too experienced with joins and can't get my head round what I have researched in context to my query.
SQL
SELECTDocument.Name,DocumentInstance.IdDocumentInstanceId,DocumentInstance.Version,...