We have a script that has an issue. The problem is if we created a work order for the same product 4 different times in a year then it's telling us to pull each item 4 times. So basically it's pulling up info for all the work orders for this product...and we need it tied to only the current work order that we are working on.
The old code commented out didn't have this problem so i looked at it and i see this:
LEFT JOIN work_order wo ON [login to view URL] = '$work_order_id'
so that is what i think we are missing in the new code but i'm not a programmer and couldn't figure out where or how to put it.
Here is the new code we have:
$res_herbs = $db->query("SELECT [login to view URL], [login to view URL], [login to view URL], [login to view URL], [login to view URL], [login to view URL]
FROM product p, pulling_herbs ph, lot l
WHERE [login to view URL]
IN (
SELECT [login to view URL]
FROM pulling_herbs ph
LEFT JOIN pulling g ON ph.pulling_id = [login to view URL]
LEFT JOIN product p ON [login to view URL] = [login to view URL]
LEFT JOIN lot l ON [login to view URL] = ph.lot_id
WHERE [login to view URL] = '$sku'
)
AND [login to view URL]
IN (
SELECT [login to view URL]
FROM pulling_herbs ph
LEFT JOIN pulling g ON ph.pulling_id = [login to view URL]
LEFT JOIN product p ON [login to view URL] = [login to view URL]
WHERE [login to view URL] = '$sku'
)
AND [login to view URL] = [login to view URL]
AND [login to view URL] = ph.lot_id");
So to clarify we don't need anything taken away from the code...we just need it to only show the data that is tied to the [login to view URL] that we are currently working on.