If I perform a create table like below in T-SQL based on that select statement the previously existed:
create table #CodesToVoid
(
PromotionId int,
PromotionId int,
Code nchar(10),
BookingReference nvarchar(50)
)
INSERT #CodesToVoid
SELECT
p.PromotionId [MasterPromotionID],
pc.PromotionId, pc.Code, pc.BookingReference
FROM
J2H.dbo.Promotions p...
I find it strange to have to promotionID as one is coming from alias p. and the other from alias pc. If in the create table statement I call one of the PromotionId as:
PromotionId [MasterPromotionID] int
It displays a syntax error. Same if I do it as:
PromotionId AS MasterPromotionID int
My question is that I need two promotionId in the create table in this situation because the select statement has two of these?