473,466 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

sql query latest version of document

8 New Member
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 1694
Rabbit
12,516 Recognized Expert Moderator MVP
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 Recognized Expert Specialist
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
lsauravbi
8 New Member
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 Recognized Expert Moderator MVP
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.