I have a table that contains information about suppliers for a part
Background: This table is a join of
- The part master record, which contains
- the Part Number, Part Name and default supplier.
- The other table is the Supplier information table which contains
- The records for the part number against the supplier and their quote for the part (There is extra information I have left out of this example)
In this table some of the parts the default supplier is NULL. For those records I would like to INSERT a new record as a placeholder i.e. #3 below
Some parts have a default supplier, but there is no record of a possible supplier (with quote). For those records I would also like to INSERT a new record as a placeholder. i.e. #1 below
Current Table
+-------+-----------+-------------------+-------------------+------------+------------+
|PART |PART NAME |Default Supplier |Possible Suppliers |Quote |InfoComplete|
+-------+-----------+-------------------+-------------------+------------+------------+
|#1 |Part 1 |Supplier 5 |Supplier 1 |25.0 |0 |
|#1 |Part 1 |Supplier 5 |Supplier 2 |20.5 |0 |
|#2 |Part 2 |Supplier 10 |Supplier 10 |10.4 |1 |
|#3 |Part 3 |NULL |Supplier 3 |9.5 |0 |
|#3 |Part 3 |NULL |Supplier 4 |11.5 |0 |
+-------+-----------+-------------------+-------------------+------------+------------+
Desired Output (Space shown for clarity)
+-------+-----------+-------------------+-------------------+------------+------------+
|PART |PART NAME |Default Supplier |Possible Suppliers |Quote |InfoComplete|
+-------+-----------+-------------------+-------------------+------------+------------+
|#1 |Part 1 |Supplier 5 |Supplier 1 |25.0 |0 |
|#1 |Part 1 |Supplier 5 |Supplier 2 |20.5 |0 |
|#2 |Part 2 |Supplier 10 |Supplier 10 |10.4 |1 |
|#3 |Part 3 |NULL |Supplier 3 |9.5 |0 |
|#3 |Part 3 |NULL |Supplier 4 |11.5 |0 |
| | | | | | |
|#1 |Part 1 |Supplier 5 |**MISSING** |NA |0 |
|#3 |Part 3 |**MISSING** |**MISSING** |NA |0 |
+-------+-----------+-------------------+-------------------+------------+------------+
From what I have read a merge statement might be a solution, but I couldn't get it to work at all.
EDIT:
Sorry I should have been a little clearer in my initial post, the information is being exported to for users to review missing data. No plans to replace the NULL values in the database.
I only wanted to manipulate the data to make it clearer for users to understand the data.
Based on feedback I'm looking at better ways to display the information to the users.