我试图在我的存储过程中加入这两个语句。我该怎么做才能得到一张桌子,这样我就可以使用 groupBy 列。
Select
TableA.Name,
TableB.Occupation,
'Group1' AS [groupBy]
From
TableA,
TableB
Where
TableA.ID = 1
Select
TableA.Name,
TableB.Occupation,
'Group2' AS [groupBy]
From
TableA,
TableB
Where
TableB.ID = 10
我的结果应该是这样的
Name Occupation GroupBy
David Doctor Group1
John Pilot Group1
Dwayne Wrestler Group2
Axel RockStar Group2
更新
Table A
ID Name Occupation
1 David Doctor
1 John Pilot
2 Mike Clerk
Table B
ID Name Occupation
3 Wayne Writer
4 Shane Publisher
10 德韦恩摔跤手 10 阿克塞尔摇滚明星