I am trying to write a query to return the users, some info about them and which security group they're assigned to. Some users have more than one group however, so I instead of returning 2 rows, I would like to combine the security group names.
SELECT ur.loginname
,ur.firstname
,ur.lastname
,sg.securitygroupname
,jt.description
FROM users ur
,usersecuritygroup us
,securitygroup sg
,jobtitle jt
WHERE ur.doctorfacilityid = us.doctorfacilityid
AND us.securitygroupid = sg.securitygroupid
AND ur.jobtitle = jt.jtid
So instead of getting 2 rows like this:
jdoe john doe group1 xyz
jdoe john doe group2 xyz
I would like to return 1 row like this:
jdoe john doe group1, group2 xyz
The security group would be the only column that would have more than one row to meet the criteria (if that matters).