|
Posted by Ed Murphy on 01/18/07 19:48
haslam007@gmail.com wrote:
> Ed Murphy wrote:
>> parth wrote:
>>
>>> I want to achieve the following transformation of data using a stored
>>> procedure.
>>>
>>>
>>> Source
>>>
>>> col1 col2(varchar)
>>> -------------------------
>>> 1 1.1
>>> 1 1.2
>>> 2 2.1
>>> 2 2.2
>>> 2 2.3
>>> =================
>>>
>>> Desired Result
>>>
>>> col1 col2(varchar)
>>> --------------------------
>>> 1 1.1 | 1.2
>>> 2 2.1 | 2.2 | 2.3
>>> =====================
>> Eww. Are you sure you can't do this in the application layer? (It
>> would be simple in Crystal Reports, for instance.)
> How would i do this in Crystal?
(Don't top-post. Fixed.)
1) Group by col1
2) In the group header section, add a function "Initialize List":
Shared StringVar Col2List := "";
""
3) In the detail section, add a function "Accumulate List":
Shared StringVar Col2List;
if Col2List = ""
then Col2List := {col2}
else Col2List := Col2List + " | " + {col2};
""
and then suppress the section from printing.
4) In the group footer section, add a function "Print List":
Shared StringVar Col2List;
Col2List
Navigation:
[Reply to this message]
|