If I have data like this in a table
id data
-- ----
1 1
1 2
1 3
2 4
2 5
3 6
3 4
How do I get results like this in a query (on sybase server)?
id data
-- ----
1 1, 2, 3
2 4, 5
3 6, 4
If I have data like this in a table
id data
-- ----
1 1
1 2
1 3
2 4
2 5
3 6
3 4
How do I get results like this in a query (on sybase server)?
id data
-- ----
1 1, 2, 3
2 4, 5
3 6, 4
In mysql, use
or use your custom separator:
see GROUP_CONCAT.
I think you're going to have to use a cursor (http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__BookTextView/50501;pt=50305)
In PL/SQL you can do it by: