Reputation: 241
Please help. I have the below SQL code and it keeps getting errors:
create view vwUpcoming
as
Select a.Auction_ID, b.item_name, b.Item_Description,
b.Item_value, a.Expected_Start_time
from Auction_schedule a
join Item b
on Auction.Item_ID= Item.Item_ID
where a.Expected_Start_Time < CURRENT_TIMESTAMP
The error message is:
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "Item.Item_ID" could not be bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "Auction.Item_ID" could not be bound.
Upvotes: 1
Views: 408
Reputation: 247690
You are using the wrong aliases on this line:
on Auction.Item_ID= Item.Item_ID
You have called these tables either a
or b
so you need to reference those names, change the line to this:
on a.Item_ID= b.Item_ID
So your full query will be:
create view vwUpcoming
as
Select a.Auction_ID, b.item_name, b.Item_Description,
b.Item_value, a.Expected_Start_time
from Auction_schedule a
join Item b
on a.Item_ID= b.Item_ID
where a.Expected_Start_Time < CURRENT_TIMESTAMP
Upvotes: 4