/build/static/layout/Breadcrumb_cap_w.png

Help Finding the "Assignee Name" in the kace database using mysql

Hello Guys.


I am creating a custom report in the k1.

I have an ODBC connection to the database with mysql.

I am trying to find the table with the "Assignee name", but for

the life of me, I can't.

In the "MACHINE" table I only see the "last logged on user", and

the "username" field.

I want to create a report to show that "last logged on user" is different

from the "assagnee name" field.



0 Comments   [ + ] Show comments

Answers (3)

Answer Summary:
Posted by: KevinG 2 years ago
Red Belt
1

select MACHINE.NAME as 'PC Name' ,
ASSET.NAME as 'Asset Name',
USER.USER_NAME as 'Assignee Name'
from MACHINE
join ASSET on ASSET.MAPPED_ID = MACHINE.ID
join USER on USER.ID = ASSET.OWNER_ID
 


Comments:
  • Thanks KevinG. Great Query - akmagnum 2 years ago
Posted by: Unsullied 2 years ago
Yellow Belt
0

Hey akmagnum,


You can check this out for comparing last logged in user with assigned user report. You may modify the query to your needs. Cheers mate


SELECT 

M.NAME, 

M.MAC, 

M.BIOS_SERIAL_NUMBER, 

M.LAST_USER AS LAST_USER,

U.FULL_NAME AS ASSIGNED_USER

FROM MACHINE M

LEFT JOIN ASSET A ON M.ID = A.MAPPED_ID

LEFT JOIN USER U ON A.OWNER_ID = U.ID

ORDER BY M.NAME


Comments:
  • You gave me the answer i needed. Owner_id was the key. Thanks Unsullied. - akmagnum 2 years ago
Posted by: Hobbsy 2 years ago
Red Belt
0

You are probably struggling as the "Assignee Name" is actually an ASSET field not a MACHINE field, but is shown in the Summary section as dictated by the ASSET_TYPE of DEVICE.

So if you look in the ASSET table you will find the ASSET.OWNER_ID is the link to the USER table wherein you will find the name associated with that ID.


So something like this will show you the assigned user and the assigned owner


SELECT ASSET.NAME, USER.USER_NAME, MACHINE.USER_NAME

  FROM (ASSET ASSET

        INNER JOIN MACHINE MACHINE ON (ASSET.MAPPED_ID = MACHINE.ID))

       INNER JOIN USER USER ON (ASSET.OWNER_ID = USER.ID)

WHERE ASSET.ASSET_TYPE_ID = 5


And the following would show only devices where the assigned name is different to the asset owner


SELECT ASSET.NAME, USER.USER_NAME, MACHINE.USER_NAME

  FROM (ASSET ASSET

        INNER JOIN MACHINE MACHINE ON (ASSET.MAPPED_ID = MACHINE.ID))

       INNER JOIN USER USER ON (ASSET.OWNER_ID = USER.ID)

WHERE ASSET.ASSET_TYPE_ID = 5 AND

USER.USER_NAME != MACHINE.USER_NAME



Comments:
  • Thanks Hobbsy. ITNINJA never dissapoints - akmagnum 2 years ago

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