Reputation: 4427
Basically what I'm trying to figure out is, Say I have
table 1tbl1
ID | Name
and table2tbl2
ID | Name
Then I have a mapping table mt
ID | tbl1ID | tbl2ID
Data really isn't important here, and these tables are examples.
How to make a view
that will grab all the items in tbl1
that aren't mapped to mt
.
I'm using Microsoft SQL-server 2008 by the way.
Upvotes: 1
Views: 195
Reputation: 425441
CREATE VIEW v_unmapped
AS
SELECT *
FROM tbl1
WHERE id NOT IN
(
SELECT tbl1Id
FROM mt
)
Upvotes: 2