SELECT
LTRIM( REPLACE(
REPLACE(
XMLAGG(XMLELEMENT("x", clientid) ORDER BY clientid),
'
','
),
'
),','
) as allclients
FROM (SELECT DISTINCT clientid
FROM clients)
In above query there is a table called clients where clientid is a field.
When above query is executed the result will be as shown below:
clients
1,2,3,4,5,.....
where the client with ids 1-5 are present in the clients table.
This worked perfectly in oracle 10g. I haven't checked in other.
No comments:
Post a Comment