February 2, 2017 at 12:09 pm
Inventory
Item Description PO Ordered Due
APEN Nice Pen
PO
Item PO Ordered Due
APEN 123456 01012017 02022017
INSERT INTO #Inventory (PO, Ordered, Due)
SELECT #PO.PO, #PO.Ordered, #PO.Due
FROM #PO
left JOIN #Inventory ON #Inventory.Item = #PO.Item
It is not joining the items. It appends it to the bottom. Can anyone tell me what I'm doing wrong? I don't see any spaces in the item numbers, and have tried every join I can think of. Thank you.
February 2, 2017 at 12:21 pm
lynn1233 - Thursday, February 2, 2017 12:09 PMInventory
Item Description PO Ordered Due
APEN Nice PenPO
Item PO Ordered Due
APEN 123456 01012017 02022017INSERT INTO #Inventory (PO, Ordered, Due)
SELECT #PO.PO, #PO.Ordered, #PO.Due
FROM #PO
left JOIN #Inventory ON #Inventory.Item = #PO.ItemIt is not joining the items. It appends it to the bottom. Can anyone tell me what I'm doing wrong? I don't see any spaces in the item numbers, and have tried every join I can think of. Thank you.
It is doing the join, and then inserting the results of the join into #inventory. You need an UPDATE query, by the look of it, not an INSERT.
Update i
set PO = p.PO, Ordered = p.Ordered, Due = p.Due
FROM #PO p
JOIN #Inventory i ON i.Item = p.Item
February 2, 2017 at 12:28 pm
Thank you. That worked. Must not be getting enough sleep. Thanks again.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply