--> 建立数据表
if object_id('tempdb.dbo.#tb1') is not null drop table #tb1
go
create table #tb1([blu1] varchar(2))
insert #tb1
select '05' union all
select '06' union all
select '07'
if object_id('tempdb.dbo.#tb2') is not null drop table #tb2
go
create table #tb2([blu2] varchar(2))
insert #tb2
select '09' union all
select '12'
--> 测试数据
select rtrim(a.blu1)+ltrim(b.blu2) as [结果]
from #tb1 a,#tb2 b
想要的结果是
请指点如何修改语句,谢谢。
------解决思路----------------------
select rtrim(a.blu1)+' '+ltrim(b.blu2) as [结果]
from #tb1 a,#tb2 b
这样不行吗?
------解决思路----------------------
select rtrim(a.blu1)+' '+ltrim(b.blu2) as [结果]
from #tb1 a,#tb2 b
------解决思路----------------------
跟你的sql不一样,中间加了一个字符,为空格
select rtrim(a.blu1)+' '+ltrim(b.blu2) as [结果] from #tb1 a,#tb2 b
------解决思路----------------------
select rtrim(a.blu1)+' '+ltrim(b.blu2) as [结果]
from #tb1 a,#tb2 b