Creating a device collection to gather computers that start or end with a particular string is mostly done using %. If the percent symbol is used at the end of the variable name, you get all computer names that starts from particular string and if you use this in the beginning, gets all computers that ends with particular string.
An example of this: To get all of the devices that start with appman-, use appman-% and to get all the machines that end with -appman then use, %-appman.
The statement I used in my environment is listed below, just change the “Appman-” with your preference.
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Name like “Appman-%”