我有这样的记录: -
1|Share Capital|Subscribed and paid up
1|Share Capital|Capital Redemption Reverse
1|Share Capital|12% Debertures
1|Share Capital|plant and machinery
1|Share Capital|Shares in SBI
1|Share Capital|Stock in Trade
1|Share Capital|Provisions for taxation
1|Share Capital|Bill Receivable
1|Share Capital|BTPL LOAN
我只想立即写出Share Capital (第2列),将第3列作为子记录。有蚂蚁查询删除重复值,并给我输出如: -
1 Share Capital Subscribed and paid up
Capital Redemption Reverse
12% Debertures
plant and machinery
Shares in SBI
Stock in Trade
Provisions for taxation
Bill Receivable
BTPL LOAN
答案 0 :(得分:0)
你可以做两件事
使用像MongoDB这样的No SQL数据库。这将允许您存储BSON文档,您可以将列表作为列,而SQL数据库只允许单个值。
规范化表格。这将涉及将表分成2个表并使用外键引用。
答案 1 :(得分:0)
你可以尝试这个
select distinct column1 ,column2,
STUFF( (select ' '+CONVERT(varchar,b.column3) from tbl_emp b
where b.column1 = a.column1 and b.column2 = a.column2
for xml path('')), 1, 1, '') from table
答案 2 :(得分:0)