将前缀文本添加到 select 语句
Add prefix text to select statement
我正在尝试在两个具有一些匹配主键的不同服务器上 运行 select 语句。我希望能够 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
在 select 语句中试试这个:
select CONCAT('A', a.id) as ID, a.*,':', //etc
This link 也有帮助。
我正在尝试在两个具有一些匹配主键的不同服务器上 运行 select 语句。我希望能够 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
在 select 语句中试试这个:
select CONCAT('A', a.id) as ID, a.*,':', //etc
This link 也有帮助。