I have a table of information in a SQL Server database and another table of group info which I'd like to concatenate into the first table.
e.g.
table1:
1 | 'foo' | 'bar,baz'
and
table2:
1 | 'bar'
1 | 'baz'
I want to replace the need for that third column in table1 by doing a GROUP BY CONCAT
with table2
. The only issue is after I am done developing this project I'm conscious I will need to port the SQL to Oracle, so perhaps doing a separate SELECT for one column of the gridview is a better alternative?
Thanks a lot.
Easy MS SQL concat can be done with converting rows you need to XML and back to nvarchar. Example: Imagine you have 2 tables - one for Contacts (with PK ID) and second with ContactTypes (with ContactID as FK, could have multiple rows for 1 contact). You need to concat all types to 1 row. Here is trick to do this:
This should make output like this:
etc.
Dunno about Oracle port, hope this helps...