myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


Request report query assistance

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003 >> Request report query assistance Page: [1]
Login
Message << Older Topic   Newer Topic >>
Request report query assistance - 9/11/2008 9:35:21 AM   
gwenger

 

Posts: 66
Score: 6
Joined: 3/13/2006
Status: offline
SQL/WQL is not my strong suit. Could one of you provide the necessary additions to following report, that would provide me with the omission of duplicate QNumbers and a column on the count of the QNumbers? -Thanks Gary

select
v_GS_PatchStatusEx.ID, v_GS_PatchStatusEx.QNumbers, v_GS_PatchStatusEx.Title
from
v_FullCollectionMembership
inner join v_GS_PatchStatusEx on v_GS_PatchStatusEx.ResourceID = v_FullCollectionMembership.ResourceId
inner join v_ApplicableUpdatesSummaryEx on v_ApplicableUpdatesSummaryEx.UPdateId = v_GS_PatchStatusEx.UpdateID
inner join v_GS_OPERATING_SYSTEM on v_FullCollectionMembership.ResourceId = v_GS_OPERATING_SYSTEM.ResourceId
where
v_FullCollectionMembership.CollectionID = 'xxxxxxxx'
and
(v_ApplicableUpdatesSummaryEx.Type = 'Microsoft Update')
and
(v_GS_PatchStatusEx.LastStateName != 'Install Verified')
order by
v_GS_PatchStatusEx.QNumbers
Post #: 1
RE: Request report query assistance - 9/11/2008 10:20:18 AM   
gjones


Posts: 824
Score: 50
Joined: 6/5/2001
From: Ottawa, Ontario, Canada
Status: offline
Add the word "distinct" after the "select"  so it woudl not be "select Distinct ..."
That shoudl do the trick.

_____________________________

Garth@enhansoft.com

For a List of my Articles
http://www.myitforum.com/contrib/default.asp?cid=116
Blogs:
http://smsug.ca/blogs/garth_jones/default.aspx
http://myitforum.com/cs2/blogs/gjones/default.aspx


(in reply to gwenger)
Post #: 2
RE: Request report query assistance - 9/11/2008 9:32:25 PM  1 votes
jnelson993


Posts: 900
Score: 127
Joined: 2/18/2005
From: Minneapolis, MN
Status: offline
I think what Garth is trying to say is :), you have there some views you aren't using...also if you want to include counts AND eliminate dupes you have to use a GROUP BY.  And for what it's worth, I prefer using v_GS_PatchStateEx instead of v_GS_PatchStatusEx because it's more reliable in my opinion and you don't have to look for a series of status numbers or the absense of a status number.  If it's Applicable, you need it.  If it's INSTALLED then, by God, it's installed.  I'm thinking something like this:

(BTW, I'm using MIN(Status0) to determine if something is applicable because there are cases with certain service packs and low priority office patches that you may have multiple patches with the same MSID, Title & QNumber, but they're actually 3 different patches for the same KB.  If you pick the MIN, then they'll always show as APPLICABLE if one or more records for that patch show as applicable.  If they're all INSTALLED, then MIN will always show INSTALLED...I hope that makes sense..it's patch week and I've had little sleep.)

SELECT
  COUNT(DISTINCT CASE WHEN Status0 = 'Applicable' THEN resourceID END) AS [Count],
  MIN(Status0) AS [Status],
  ID0 as [MSID],
  QNumbers0 AS [QNumber],
  Title0 AS [Title],
  Product0 AS [Product],
  CASE Severity0
     WHEN 0 THEN 'Low'
     WHEN 2 THEN 'Moderate'
     WHEN 6 THEN 'Important'
     WHEN 8 THEN 'High'
     WHEN 10 THEN 'Critical'
     ELSE ''
  END AS [Severity],
  Severity0 AS [Severity Level]
FROM
  dbo.v_GS_PatchStateEx
WHERE
  type0 = 'Microsoft Update'
  AND resourceID IN (SELECT ResourceID FROM dbo.v_FullCollectionMembership WHERE CollectionID = 'xxxxxxxx')
GROUP BY
  ID0,
  QNumbers0,
  Title0,
  Product0,
  Severity0 
HAVING
  MIN(Status0) = 'Applicable'
ORDER BY
  MIN(Status0),
  Severity0 DESC,
  ID0 DESC,
  QNumber DESC
 

_____________________________

Number2 (John Nelson)
MyITForum - Blog
MyITForum - Forum Posts

(in reply to gwenger)
Post #: 3
RE: Request report query assistance - 9/12/2008 10:21:58 AM   
gwenger

 

Posts: 66
Score: 6
Joined: 3/13/2006
Status: offline
John-

That is one fine report, thanks for your assistance. Especially during patch week!

-Gary

(in reply to jnelson993)
Post #: 4
Page:   [1]
All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003 >> Request report query assistance Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.188