SQL Report about Users

hi,

i need to write a report about the users in the jira database. The report should contain the display_name, the last login date and a check if the user are in the confluence or jira group.

i have wrote the following query, but:

1. i think i have a mistake in the check if jira or confluence

2. in the cwd_user are users doubled, in the directory 10000 and 1, i need both unfortunally, if the user is in 10000 i dont need the 1, but if its not in 10000 i need the 1. I dont know how to write that

3. the date for last login doestn work, any idea why?

select
u.id,
U.display_name as Benutzer,
dateadd(second,cast(cast(a.attribute_value AS nvarchar(255)) AS bigint)/1000,'19700101 00:00:00:000'),
CASE WHEN member.parent_name = 'confluence-users' THEN 'JA' ELSE 'Nein' END as Confluence,
CASE WHEN member2.parent_name = 'jira-software-users' THEN 'JA' ELSE 'Nein' END as Jira


FROM jiradb.cwd_user U
LEFT JOIN
[Jira_RFS].[jiradb].[cwd_membership] member on member.child_id = U.ID and member.parent_name = 'confluence-users'
LEFT JOIN
[Jira_RFS].[jiradb].[cwd_membership] member2 on member2.child_id = U.ID and member2.parent_name = 'jira-software-users'
LEFT JOIN
[Jira_RFS].[jiradb].[cwd_user_attributes] a on a.user_id = u.id
--where u.CREDENTIAL != 'nopass'

group by
u.id,
U.display_name,
dateadd(second,cast(cast(a.attribute_value AS nvarchar(255)) AS bigint)/1000,'19700101 00:00:00:000'),
CASE WHEN member.parent_name = 'confluence-users' THEN 'JA' ELSE 'Nein' END,
CASE WHEN member2.parent_name = 'jira-software-users' THEN 'JA' ELSE 'Nein' END;

1 answer

0 vote

Oliver, I don't understand the details of the JIRA database schema, but as another solution, you could export the user data to Excel and do the filtering, formulas, etc. in Excel.

excel-user-export

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

118 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you