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 Pushing Packages in Multi-Domain Trusted Environment
by  SPedraza   Go to last post Go to first unread
Last post: Yesterday at 5:43:05 PM(UTC)
Lansweeper Lansweeper Not Saving New Asset
by  Terry1337  
Go to last post Go to first unread
Last post: Yesterday at 3:52:51 PM(UTC)
Lansweeper Email configuration
by  Ian.Prentice   Go to last post Go to first unread
Last post: Yesterday at 3:14:04 PM(UTC)
Lansweeper InTune Scanning not showing all devices
by  TBRIT  
Go to last post Go to first unread
Last post: Yesterday at 3:12:03 PM(UTC)
Lansweeper Unique Custom Fields
by  Hendrik.VE   Go to last post Go to first unread
Last post: Yesterday at 11:52:35 AM(UTC)
Lansweeper Uptime incorrect
by  alfiet  
Go to last post Go to first unread
Last post: Yesterday at 10:53:33 AM(UTC)
Lansweeper Lansweeper Remote Screenshot Folder
by  Esben.D   Go to last post Go to first unread
Last post: Yesterday at 10:24:31 AM(UTC)
Lansweeper Lansweeper Enterprise optional?
by  Esben.D  
Go to last post Go to first unread
Last post: Yesterday at 10:00:22 AM(UTC)