System Info - plch/sierra-sql GitHub Wiki

Match statistic_group to sierra login and host information for self checkout devices

SELECT
s.code,
s.location_code,
s.name,
u.name as ils_login,
u.iii_user_group_code as user_group_code,
u.full_name,
n.port,
n.ip_range,
n.comment,
(
	SELECT
	COUNT(*)
	FROM
	sierra_view.circ_trans as c
	WHERE
	c.stat_group_code_num = s.code
) as count_last_2wk_transactions
FROM
sierra_view.statistic_group_myuser as s

JOIN
sierra_view.iii_user as u
ON
  u.statistic_group_code_num = s.code

JOIN
sierra_view.network_access_view as n
ON
  n.login_name = u.name


where
s.name ~* '^.*schk[0-9]{1,}'

ORDER BY
s.location_code,
s.name