Jump to content

SQL Outer Join multiple Views


ilc

Recommended Posts

I am trying to join data from two views. The first has a column "Type". I need to insert data from the second but identify it as a certain "Type". I have performed an Outer Join. How can I insert type for the data in the second view.

The "Type" field in the first view is identifying whether the inventory is on hand or inbound. I want to identify the data from the second view as Type- Vendor Contract.

My columns are:

1st view (Inventory on Hand/Inbound) -  Item Code, Desc, Qty, Type

2nd view (Inventory Contracted with Vendors)-  U_Item Code, Desc, Qty

Link to comment
Share on other sites

Is it necessary to have them in separate tables? This seems like the exact trouble you'd run if they're separate.

 

You might want to look at `CASE` statements, and using `EXISTS`. If you really want to go down this route. I tried looking at these questions:

https://stackoverflow.com/questions/4076098/how-to-select-rows-with-no-matching-entry-in-another-table/36694478#36694478

https://stackoverflow.com/questions/63447/how-do-i-perform-an-if-then-in-an-sql-select

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...