I have this first query which gives the mimetype and sum of their total datasize and count of number of document
This second query gives the latest version of every document type
There is requirement that the result should have the latest version sum And count included in the result where as first query include all the sum of all versions of document and count.
how to modify the first query to include only the latest version SUM(DataSize) And count(DocID) ?
Code:
SELECT MimeType, SUM(DataSize)/1024 as Total_Size_MB,count(DocID) as Total_No_Doc FROM DVersData group by MimeType
Code:
SELECT DocID
, MAX([Version]) AS [MaxVersion]
FROM dversdata (nolock)
GROUP BY DocID
how to modify the first query to include only the latest version SUM(DataSize) And count(DocID) ?
Comment