How to retrieve QueueItems with process name from UiPath Orchestrator DB using SQL Query?

hi all
i want to retrieve all QueueItems with process name from UiPath Orchestrator DB using SQL Query .
in QueueItems table there is no process name.
i have already find this join query between jobs and robot but i want to add QueueItems table to it !
the join query is :

SELECT B.[Name] as Robot,
J.Id as JobID,
CONVERT(varchar(200),R.[Name]) + CASE WHEN CHARINDEX(‘ServerList’,CONVERT(varchar(300),J.InputArguments)) > 0 THEN ‘-’+LEFT(SUBSTRING(CONVERT(varchar(300),J.InputArguments),16,999),LEN(SUBSTRING(CONVERT(varchar(300),J.InputArguments),16,999)) - 2) ELSE ‘’ END as ProcessName,

M.Name as MachineName,

DATEADD(hh,DATEDIFF(hh,GETUTCDATE(),GETDATE()),J.StartTime) as Started,

DATEADD(hh,DATEDIFF(hh,GETUTCDATE(),GETDATE()),J.EndTime) as Finish,

J.StartTime,

CASE WHEN J.[State] = 0 THEN ‘Queued’

WHEN J.[State] = 1 THEN ‘Running’

WHEN J.[State] = 2 THEN ‘Stopping’

WHEN J.[State] = 3 THEN ‘Terminating’

WHEN J.[State]= 4 THEN ‘Failed’

WHEN J.[State]= 5 THEN ‘successful’

WHEN J.[State] = 6 THEN ‘Canceled’

ELSE CONVERT(varchar(10),J.State) END as JobStatus,

J.InputArguments,

J.Info

FROM Jobs J

INNER JOIN Robots AS B ON J.RobotId = B.[Id]

INNER JOIN Machines AS M ON J.MachineId = M.[Id]

INNER JOIN Releases AS R ON J.ReleaseId = R.[Id]

–WHERE J.TenantId = 1

ORDER BY J.InputArguments, JobID DESC

Queues aren’t linked to Processes. You know you can get data from Orchestrator with the API instead of using database queries, right?

@Yazan_Otaibi

Now you need to find the link from Robot to Queues …ideally queueitems contain the robot info but not the process info

and that too only for processed items…for new you wont be able to link through robots as well

cheers

yes i know i can use api
actually i want to retrieve qitem details with process name !
but i cant find solution to join between the tow table

actually i want to retrieve qitem details with process name !
but i cant find solution to join between the tow table

Like I said, there is no link between Queue Items and Processes. Queues are not linked to Processes.

ok bro,
but also as the shoun query that i found and post it the process name in release table there is no direct join with jobs table but by using:

CONVERT(varchar(200),R.[Name]) + CASE WHEN CHARINDEX(‘ServerList’,CONVERT(varchar(300),J.InputArguments)) > 0 THEN ‘-’+LEFT(SUBSTRING(CONVERT(varchar(300),J.InputArguments),16,999),LEN(SUBSTRING(CONVERT(varchar(300),J.InputArguments),16,999)) - 2) ELSE ‘’ END as ProcessName,

its linked and retrieved a mapped table

+thanks for your support.