I currently have a table like this:
| FK_ID | Name | Updated_Date |
|---|---|---|
| 1 | PLANNED | [Some Date] |
| 1 | DOING | [Some Date] |
| 2 | PLANNED | [Some Date] |
| 2 | DOING | [Some Date] |
| 2 | DONE | [Some Date] |
| 3 | PLANNED | [Some Date] |
The problem I'm having is I'd like to insert all missing PLANNED, DOING, DONE for every set of FK_ID's into the table so the result would be
| FK_ID | Name | Updated_Date |
|---|---|---|
| 1 | PLANNED | [Some Date] |
| 1 | DOING | [Some Date] |
| 1 | DONE | [Blank] |
| 2 | PLANNED | [Some Date] |
| 2 | DOING | [Some Date] |
| 2 | DONE | [Some Date] |
| 3 | PLANNED | [Some Date] |
| 3 | DOING | [Blank] |
| 3 | DONE | [Blank] |
I had the idea to create a table, although I'm sure a temp table would be fine that would just be
| Name |
|---|
| PLANNED |
| DOING |
| DONE |
and then do something with OUTER LEFT JOIN and/or NOT IN's but I'm not getting what I'm looking for. I'm thinking I need to have a query with a subquery with those but SQL guy I am not. Here's what I have so far:
SELECT e.*
FROM ActualData e
OUTER LEFT JOIN TempTable i
ON e.Name = i.Name WHERE i.Name IS NULL
This does give me some data, but only the ones that don't appear in ANY of the records of the ActualData table.