LabTech Support Forums

Dataview with Count in a Column

This forum is for discussion of dataview related issues.

Moderator: jware.connectwise

Dataview with Count in a Column

Postby dbartelli » Fri Mar 30, 2012 10:47 am

Has anyone created a dataview that returns the count of something in a column instead of the actual data? I'm looking for an example doing this, but my end goal is to have a dataview that shows the following columns with each row being a different server:

Client Name, Location Name, Server Name, (Count of Windows Event Log Errors)

Ultimately I'll refine that further to say # errors from the past week or some other time period

thanks
dave
dbartelli
Newbie
Newbie
 
Posts: 40
Joined: Sun Jan 23, 2011 10:47 pm

Re: Dataview with Count in a Column

Postby joseph.xlcon » Thu Feb 06, 2014 9:59 pm

Here is an example of how I count logs for symantec. I dont really know sql so this might be a bad example but I was able to create what I needed. I dont have a dataview anymore that actually does the query but this is part of what I use in the back end for posting threat counts to an extra data field, then I have a dataview that just shows that EDF along with the client name, computer name and last alert time.

Code: Select all
SELECT DISTINCT eventlogs.computerid AS 'computerid', MAX(eventlogs.timegen) AS 'threattime', COUNT(*) AS 'threatcount'
FROM eventlogs WHERE eventlogs.eventid='51' AND eventlogs.message NOT LIKE '%cookies%' AND eventlogs.source LIKE '%Symantec%'  AND eventlogs.timegen > DATE_ADD(NOW(),INTERVAL -7 DAY) GROUP BY eventlogs.computerid;
joseph.xlcon
Newbie
Newbie
 
Posts: 31
Joined: Mon Jun 04, 2012 11:52 pm


Return to Dataviews

Who is online

Users browsing this forum: No registered users and 1 guest

cron