如何更改mySQL代码以在Oracle SQL 11g中工作
SELECT a.boxid,
GROUP_CONCAT( CONCAT( b.quantity, \' x \', c.name ) SEPARATOR \', \' ) Items
FROM box a
INNER JOIN item_line b ON a.boxid = b.boxid
INNER JOIN items c ON b.itemid = c.itemid
此查询的输出如下所示:
boxid items
1 2 x ball,4 x bat
2 ball
3 3 x cap,2 x ball,bat
4 2 x ball
感谢您的回答。
答案 0 :(得分:1)
使用LISTAGG()
SELECT boxid,
LISTAGG(quantity || ' x ' || name, ',')
WITHIN GROUP (ORDER BY boxid) AS items
FROM tableName
GROUP BY boxid
答案 1 :(得分:0)
您可以尝试Oracle的SQL Developer Migration(这是一款免费产品)。文档说它将有助于将Microsoft Access,Microsoft SQL Server,MySQL和Sybase迁移到Oracle:
http://www.oracle.com/technology/tech/migration//workbench/index%5Fsqldev%5Fomwb.html