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.

 

 

 

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

3

Try this

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

Answered 07/11/2012 by: darkhawktman
Green Belt

Please log in to comment

Answers

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.

Answered 07/12/2012 by: chucksteel
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity