比如说,我有表a表b,a的unid跟b的a_unid对应但不是一一对应关系
a.unid=100
b里有两列与a对应
列1:b.a_unid=100,b.nr=b1,b.name=tom
列2:b.a_unid=100,b.nr=b2,b.name=jerry
现在我希望用select查询语句查询后,显示以下一列两行内容:
100 b1/tom,b2/jerry
有办法吗?
------解决方案--------------------
- SQL code
SELECT a.unid, wm_concat (b.nr || '/' || b.NAME) NAME FROM a, b WHERE b.a_unid = a.unidGROUP BY a.unid
------解决方案--------------------
- SQL code
select t.id,wmsys.wm_concat(t.v ) from (select a.id,b.nr||'/'||b.name v from p1 a ,p2 b where a.id = b.id) t group by t.id;