Reputation: 15
CREATE VIEW titles_borrowed
AS
SELECT b.booktitle, o.bookid
FROM books b
INNER JOIN o borrowed ON b.bookid = o.bookid
I'm getting the following error when I try to run this:
Msg 208, Level 16, State 1, Procedure titles_borrowed, Line 4 [Batch Start Line 5]
Invalid object name 'o'
Upvotes: 0
Views: 76
Reputation: 100
You need to switch o and borrowed:
CREATE VIEW titles_borrowed
AS SELECT b.booktitle,o.bookid
FROM books b
INNER JOIN borrowed o
ON b.bookid = o.bookid
First the table then the alias.
Upvotes: 1