View Single Post
Old 12-07-2012, 10:56 PM   PM User | #19
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,650
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Can those tables be unioned in some fashion?
Give it a nested query instead. Or just don't use the ws_concat :]

Edit:
BTW if it helps here's an example of one that I have in MySQL:
Code:
SELECT u.name AS usergroupname, GROUP_CONCAT(p.name ORDER BY p.name ASC SEPARATOR ', ') AS members
FROM acl_usergroupmembers ugm
INNER JOIN core_principal u ON u.pid = ugm.usergroupid
INNER JOIN core_principal p ON p.pid = ugm.pid
GROUP BY u.name
ORDER BY usergroupname ASC
Which returns me:
Code:
*************************** 1. row ***************************
usergroupname: Administrators
      members: Administrator, Fou-Lu
*************************** 2. row ***************************
usergroupname: Users
      members: Administrators, Fou-Lu
Which (despite how it may look) is accurate.
You'll noticed that MySQL will let me use a group by on an alias. I don't believe that Oracle does simply because of how the engines differ in their approaches. Oracle will have a way though for sure, I just don't know what it is.

Last edited by Fou-Lu; 12-08-2012 at 04:46 PM..
Fou-Lu is offline   Reply With Quote