Notification

Icon
Error

Jelly
#0Jelly Member Posts: 7  
posted: 5/17/2019 12:09:20 AM(UTC)
Originally Posted by: smozie Go to Quoted Post
I am trying to write a report to find assets within our US domain, that are tied to the tblADUsers.Department %IT% and do no have versions 6.0.0 or 6.0.1 of Traps on their system. I run the code below and what I get back is a bit of a mess, looking for help.

Code:

Select Top 100000 tblAssets.AssetID,
  tblAssets.Domain,
  tblAssets.Username,
  tblADusers.Firstname,
  tblADusers.Lastname,
   tblADusers.Department
From tblAssets
  Inner Join tsysIPLocations On tsysIPLocations.LocationID =
    tblAssets.LocationID
  Left Join tblADusers On tblADusers.Username = tblAssets.Username And
    tblADusers.Userdomain = tblAssets.Userdomain
  Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
  Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Where tblSoftwareUni.softwareName Like '%traps%' And tblSoftware.softwareVersion Not
  Like '6.0.0%' And tblSoftware.softwareVersion Not Like '6.0.1%' AND tblADusers.Userdomain Like '%US%' And tblADusers.Department Like '%IT%'
Order By tblAssets.AssetName





Try this changed your left join and a few other things. Personally I wouldn't post with the software names/versions/domain/department info not anonymized.
Code:

Select Top 100000 tblAssets.AssetID,
  tblAssets.Domain,
  tblAssets.Username,
  tblADusers.Firstname,
  tblADusers.Lastname,
   tblADusers.Department
From tblAssets
  Inner Join tsysIPLocations On tsysIPLocations.LocationID = tblAssets.LocationID
  Left Join tblADusers On tblAssets.Username = tblADusers.Username 
  Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
  Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Where tblSoftwareUni.softwareName Like '%traps%' 
And tblSoftware.softwareVersion Not Like '6.0.0%' 
And tblSoftware.softwareVersion Not Like '6.0.1%' 
AND tblAssets.Domain = 'us'
And tblADusers.Department Like '%IT%'
Order By tblAssets.AssetName



Active Discussions

Lansweeper Firefox 67.0.3 zero-day vulnerability
by  jwood.mls   Go to last post Go to first unread
Last post: Yesterday at 10:26:56 PM(UTC)
Lansweeper User association report query
by  dan508  
Go to last post Go to first unread
Last post: Yesterday at 5:38:51 PM(UTC)
Lansweeper Computer Age Chart Report
by  RC62N   Go to last post Go to first unread
Last post: Yesterday at 5:26:15 PM(UTC)
Lansweeper Dell SupportAssist CVE-2019-12280
by  Esben.D  
Go to last post Go to first unread
Last post: Yesterday at 9:15:20 AM(UTC)
Lansweeper Office 365 OneDrive Usage and Sync
by  brodiemac   Go to last post Go to first unread
Last post: 6/21/2019 3:51:36 PM(UTC)
Lansweeper BlueKeep Vulnerability
by  Esben.D  
Go to last post Go to first unread
Last post: 6/21/2019 9:52:22 AM(UTC)
Report Center Inventory report for Adobe license reviews
by  brodiemac   Go to last post Go to first unread
Last post: 6/20/2019 8:23:15 PM(UTC)
Report Center Failed Logins Report/Chart
by  KDavis  
Go to last post Go to first unread
Last post: 6/20/2019 1:17:05 AM(UTC)