473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

sql query latest version of document

I have this first query which gives the mimetype and sum of their total datasize and count of number of document
Expand|Select|Wrap|Line Numbers
  1. SELECT MimeType,
  2. SUM(DataSize)/1024 as Total_Size_MB,count(DocID) as Total_No_Doc FROM DVersData group by MimeType
This second query gives the latest version of every document type
Expand|Select|Wrap|Line Numbers
  1. SELECT  DocID
  2.            , MAX([Version]) AS [MaxVersion]
  3.     FROM    dversdata (nolock)
  4.     GROUP BY DocID
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) ?
Apr 18 '14 #1
4 1690
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

Join the latest version query to the original table to filter for only the most recent.
Apr 18 '14 #2
ck9663
2,878 Expert 2GB
If you need just the last version, would it be just a single record and there's no need to sum anything?


~~~ CK
Apr 26 '14 #3
I need the sum of all document of particular MIME type..but its should include only the latest version of document
May 6 '14 #4
Rabbit
12,516 Expert Mod 8TB
I understand that, did you try what I suggested in post #2?
May 6 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Terence Shek | last post by:
Is there a way to set the application binding policy so that it always binds to the latest version of an assembly? I'm hoping there is a way to avoid updating the application's binding...
0
by: Eddy | last post by:
We have a somewhat large .net solution (25+ projects). All the developers using this solution have experienced at one time or another a "Get latest Version (recursive)" on the solution that has NOT...
1
by: Ralph Krausse | last post by:
What is the latest version of javascript? 1.2? Who manages this? NetScape? Who comes out with new versions? How does these changes get into Netscape and Explorer? How can I find what browsers...
0
by: Damien | last post by:
Hi, Visual Studio .NET 2003 Visual SourceSafe 6 (6.0d) I'm working in a three person team on a reasonably complex Solution - it currently consists of 9 separate projects (3 of them are plain...
76
by: kwilder | last post by:
This works, but it doesn't load the latest version of the xml if it was just modified without closing and reopening the browser. Here's the scenario: I have an xml doc called results.xml. It...
2
by: kinnu | last post by:
Hi All, I have created an application and uploaded in geocities.com\...html. I want the VB application to check the latest/updated version application from geocities\...html when it checks for...
2
by: HeroinNO.4 | last post by:
Hello everyone! Now the latest version of free count down timer source code is available in http://www.fillweb.com/countdown.htm, you can open it in IE and View->Source to see the latest version...
5
by: Ellie | last post by:
Hi, I am now starting to look into upgrading our vb6 apps to .net and need to know the latest version I should be getting. Thanks
1
by: lsauravbi | last post by:
I have table having column which stores documentid and another column storing the version of document.I want query to find out the only the latest version of document? can any one help
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.