cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
soucyinter
Engaged Sweeper III
Hello,

I have modified and already existing SQL query and applied my own search conditions. I had two conditions in the same query, one saying I want LIKE This and NOT LIKE That but then it creates two rows and this makes it impossible to sort the data of these rows because they exist twice...

What's the other way to apply a NOT LIKe and being possible to sort with the small GUID in the Report Builder?

Thank you!

Here's the SQL Query.
Select Top 1000000 tblSoftware.softwareName As Software, tblComputers.Username
As Usager, tblADusers.Displayname As DisplayName, tblADusers.OU As OU
From tblComputers Left Join
tblSoftware On tblComputers.Computername = tblSoftware.ComputerName Inner Join
tblADusers On tblADusers.Username = tblComputers.Username
Where tblSoftware.softwareName Like 'Microsoft%Project%' And
Not tblSoftware.softwareName Like '%SQL%'
Group By tblSoftware.softwareName, tblComputers.Username,
tblADusers.Displayname, tblADusers.OU, tblSoftware.Lastchanged
Order By tblComputers.Username, tblSoftware.softwareName

2 REPLIES 2
soucyinter
Engaged Sweeper III
Perfect, works like a charm!

Thank you.
Hemoco
Lansweeper Alumni
Please try the following query:

Select Top 1000000 tblSoftware.softwareName As Software, tblComputers.Username
As Usager, tblADusers.Displayname As DisplayName, tblADusers.OU As OU
From tblComputers Left Join
tblSoftware On tblComputers.Computername = tblSoftware.ComputerName Inner Join
tblADusers On tblADusers.Username = tblComputers.Username
Group By tblSoftware.softwareName, tblComputers.Username,
tblADusers.Displayname, tblADusers.OU, tblSoftware.Lastchanged
Having (tblSoftware.softwareName Like 'Microsoft%Project%' And
tblSoftware.softwareName Not Like '%SQL%')
Order By tblComputers.Username, tblSoftware.softwareName

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now