/build/static/layout/Breadcrumb_cap_w.png

Machine Smart Label based on domain user name.

I'm trying to create a Smart Label based on the user login ID for multiple users.  Here's the SQL code I have so far.

 

select *, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,

                       UNIX_TIMESTAMP(MACHINE.LAST_SYNC) as LAST_SYNC_SECONDS

                  from ORG1.MACHINE 

                  LEFT JOIN KBSYS.KUID_ORGANIZATION ON KUID_ORGANIZATION.KUID=MACHINE.KUID LEFT JOIN KBSYS.SMMP_CONNECTION ON SMMP_CONNECTION.KUID = MACHINE.KUID AND KUID_ORGANIZATION.ORGANIZATION_ID = 1

                 where ((  USER_NAME rlike 'ksmith|jdoe|lhe'))

 

It seems to work great, except using the operator "rlike" returns machines with login names for lhe, lheneger, lhennesy, etc.  If I use the oporator "=" instead of rlike, the query returns nothing.  

How do I make this query work correctly, returning only the names that match exactly? 

Thanks in advance.

 

 

 


0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: darkhawktman 12 years ago
Green Belt
3

Try this

where (  USER_Name = 'ksmith' or USER_NAME = 'jdoe' or USER_NAME = 'lhe')

Posted by: chucksteel 12 years ago
Red Belt
1

One issue you might find is that machines will come and go from this label. I believe the user_name column is updated every time the inventory runs, so if it runs and if no user is logged in there is a null value there. I don't know if that will be an issue for you or not.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ