Listing groups and their members�Posted by michael.fennell@fsa.gov.uk (Fennell, Michael) on 2011/05/16 11:59�Hi ForumI am trying to list all the groups of the system and their members which i am doing using the following sql"SELECT k.ID AS GROUPID ,k.NAME AS GROUPNAME ,k.TYPE AS GROUPTYPE ,c.ID AS USERID ,c.LASTNAME AS USERLASTNAME ,c.NAME AS USEREMAIL ,kc.idFROM kuafchildren kc ,kuaf k ,kuaf cWHERE kc.ID = k.IDAND k.TYPE = 1AND c.ID = kc.CHILDIDORDER BY c.ID ,k.ID"Of course the problem i have is this returns only groups that have members where as i would like to return the groups without members too, anyone know how i can do this or if it can be done, i guess basically what sql can i use to list all group names and the group members if they exist.Any help would be appreciated.RegardsMike.[To reply to this thread, use your normal E-mail reply function.]Discussion:Live Reports DiscussionLivelink Server:knowledge-wlweb01To Unsubscribe from this Discussion, send an e-mail to unsubscribe.livereportsdiscussion@elinkkc.opentext.com.
To Unsubscribe from this Discussion, send an e-mail to unsubscribe.livereportsdiscussion@elinkkc.opentext.com.
Hi Mike, I tried this in my instance of Content Server 10.0.0 and it didn't seem to work. Would you be able to shed anymore light on how you set it up? As in the parameters etc.?
Thanks in advance
Lenny
is your livelink db Oracle if not the "connect by" construct is a oracle specific thing.
From memory and not specific to any db
A group with a certain name like "My Good Group in livelink"
We can write
select name,id from kuaf where deleted=0 and type=1 and name like 'My Good Group in livelink'
If you then want to know who is in that group(it could be users and groups) you should query KUAFCHILDREN and the below query shows you users
select * from kuaf where type=0 and deleted=0 and id in ( select childid from kuafchildren where id=(select id from kuaf where name like 'My Good Group in livelink'))
Now the previous poster using Oracle's neat 'connect by' was taking the guess work out of you by succesively querying any groups in its way who had more to query until it reached no more.
In SQLserver db's you have to write functions or CTE's to do that kind of work
There are examples in this forum for how one would use SQLserver functions to traverse or emulate the Oracle's connect by here is a link for self study.
http://consultingblogs.emc.com/christianwade/archive/2004/11/09/234.aspx
Thank you for the help!