我想在我的存儲過程中加入這兩個語句。我該怎麼做才能得到一張表,以便我可以使用groupBy列。在存儲過程中加入sql語句
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
UPDATE
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阿克塞爾的Rockstar
你能給我們提供一些有關TableA和TableB結構的信息嗎? – 2013-04-08 21:36:06
@ Dillie-O ..謝謝..請看我的更新 – EagleFox 2013-04-08 21:43:55