读书人

跪求SQL怎么将1;2;3;中的分号去掉输

发布时间: 2012-04-12 15:46:35 作者: rapoo

跪求SQL如何将1;2;3;中的分号去掉输出的是1,2,3
select *from table_2 where Tid in(select convert(typ) from table_1 )

Table_1 表两列为Id: 1 ,2 ,3, 4 ,typ:1 ;2;3 ,1 ;2;3
Table_2 表中的两列为 Tid :1 2 3 , Name: 硬盘 ,鼠标,键盘,
就是想用Table_2 中的硬盘,鼠标,键盘 把 Table_1中的1 2 3表示出来
我们老师说就一行代码搞定 我弄了半天 貌似是select convert(typ) from table_1 中的问题

[解决办法]

探讨
select *from table_2 where Tid in(select convert(typ) from table_1 )

Table_1 表两列为Id: 1 ,2 ,3, 4 ,typ:1 ;2;3 ,1 ;2;3
Table_2 表中的两列为 Tid :1 2 3 , Name: 硬盘 ,鼠标,键盘,
就是想用Table_2 中的硬盘,鼠标,键盘 把 Table_1中……

读书人网 >SQL Server

热点推荐