【发布时间】:2015-01-09 01:13:25
【问题描述】:
我在 MS Sql 数据库中有 3 个表,我正在尝试通过查询将它们加入到单个表中,以便可以提取到 Excel 中。
我的表是 Person、Industry 和 PersonIndustry(连接表)。
Person 有 personId,industry 有 Industryid,PersonIndustry 表很简单:
PersonID、IndustryID。
示例记录:
人员表:
1, John Smith
2, Bob Jones
3. Jill Jane
行业表:
1, Medical
2, Insurance
3, Construction
个人行业:
1,1
1,2
3,1
我想要的输出是:
人物、姓名、行业
1, John Smith, Medical:Insurance
2, Bob Jones, N/A
3. Jill Jane, Medical
我该怎么做?
【问题讨论】:
标签: sql sql-server