select
a.orderid,
a.ordertype,
carno=stuff((select ','+ltrim(b.carno) from order_car where orderid=b.orderid),1,1,'')
from
[order] a
join
order_car b
on
a.orderid=b.orderid
group by
a.orderid,
a.ordertype上面的MSSQL语句在oracle 中怎么写
a.orderid,
a.ordertype,
carno=stuff((select ','+ltrim(b.carno) from order_car where orderid=b.orderid),1,1,'')
from
[order] a
join
order_car b
on
a.orderid=b.orderid
group by
a.orderid,
a.ordertype上面的MSSQL语句在oracle 中怎么写
a.orderid,
a.ordertype,
(select ltrim(b.carno) from order_car where orderid=b.orderid) carno
from
"order" a
join
order_car b
on
a.orderid=b.orderid
group by
a.orderid,
a.ordertype 看看对不对
不知为什么要在ltrim(b.carno) 前加个',',然后再用stuff去掉
a.entrunstno,
stuff((select ','+ltrim(vechicleid) from tbt_asn_zhuanche where entrunstno =b.entrunstno ),1,1,'') as carnm
from
tbt_ent_information a, tbt_asn_zhuanche b
where a.entrunstno =b.entrunstno
a.orderid,
a.ordertype,
b.carno
from
"order" a
join
order_car b
on
a.orderid=b.orderid
group by
a.orderid,
a.ordertype 看起来这样也一样了
a.orderid,
a.ordertype,
wm_concat(b.carno) carno
from
"order" a
join
order_car b
on
a.orderid=b.orderid
group by
a.orderid,
a.ordertype
看你的意思可以这样写,试试
substr((select ','+ltrim(vechicleid) from tbt_asn_zhuanche where entrunstno =b.entrunstno ),1,1) carnm
是想把子表的一个字段的多行拼成一个字段的。wm_concat好像可以解决这个问题
你测试下,10g以上的支持
在oracle中字符串拼接不要用+,改成||