我正在尝试在两个具有一些匹配主键的服务器上运行select语句。我希望能够选择主键但是为每个记录添加前缀“A”
前:
ID "to this" ID
1 A1
2 A2
3 A3
这就是我对查询的看法
select 'A' + CAST (a.id AS VARCHAR(25)) as ID,a.*,':', b.*,':',c.*,':', d.*,':', e.*,'REPORTDT', g.*
from labgen.order_ a
join patient b on a.id = b.chart
join insurance c on b.ins1 = c.code
join client d on d.num = a.client1
join salesgrp e on d.salesgroup = e.num
join reportdt g on a.accession = g.accession