Re: Weird Query

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Thu, 03 Jul 2008 21:23:21 +0200
Message-ID: <486D2729.9080109@gmail.com>


Mtek schrieb:
> Hi,
>
> I have a query which is this:
>
> SELECT cnt || ':' || t_id cnt_t_id
> FROM (SELECT COUNT(*) cnt, t_id
> FROM zc_body zb, zc_type zt
> WHERE zb.t_id = zt.id
> GROUP BY t_id);
>
> The output is this:
>
> 101:18
> 49:27
> 47:36
> 378:9
> 118:10
> 76:15
> 28:16
> 38:19
>
> However, they want the output like this:
>
> 101:18,49:27,47:36,378:9,118:10,76:15,28:16,38:19
>
> Can't figure this one out. Do not seem to have any WM_CONCAT or
> anything. we are on 10g r2.
>
> Thanks everyone!
>
> John
>
>

Here are provided dozens of different techniques to perform string aggregation:
http://www.sqlsnippets.com/en/topic-12291.html http://oracle-base.com/articles/10g/StringAggregationTechniques.php (at least, i don't know any other easy method which is not mentioned on those links). Some may look more difficult than others. I hope, you can pick up one which looks familiar for you and helps you to get desired results.

Best regards

Maxim Received on Thu Jul 03 2008 - 14:23:21 CDT

Original text of this message