Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Simple WQL query issue

The full query:

select 
  SMS_G_System_COMPUTER_SYSTEM.Name,
  SMS_G_System_COMPUTER_SYSTEM.Model,
  SMS_R_System.OperatingSystemNameandVersion,
  SMS_R_System.Build,
  SMS_R_User.UniqueUserName

from 
  SMS_R_System
    inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId
    INNER JOIN SMS_UserMachineRelationship ON SMS_UserMachineRelationship.ResourceId = SMS_R_System.ResourceId
    INNER JOIN SMS_R_User ON SMS_UserMachineRelationship.UniqueUserName = SMS_R_User.UniqueUserName

WHERE 
  SMS_UserMachineRelationship.Types = 1
  SMS_R_User.UniqueUserName LIKE "%,%"

order by 
  SMS_G_System_COMPUTER_SYSTEM.Name

The issue I am here to discuss and need assistance with is jut this line:

SMS_R_User.UniqueUserName LIKE "%,%"

No matter what I try here after the LIKE operator, it is just always a syntax error. Have no idea what is wrong with it, it matches all the examples online, and previous queries I have written.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Any ideas?

>Solution :

You have a syntax error. You’re missing an AND between the two conditions in your WHERE clause. This is standard SQL syntax, so it’s nothing special related to WQL.

It should be

WHERE 
  SMS_UserMachineRelationship.Types = 1 AND
  SMS_R_User.UniqueUserName LIKE "%,%"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading