Hello
I would like to update the column in one table based on the results of a query from another table.
I have two tables IM_ITEM and IM_INV tables. In the IM_INV table I would like to sum up the location quantities for each item. If the quantity is zero, I would like to set the DISC_COD to null for that item.
So for example, the tables contents are as follows:
IM_ITEM Table
ITEM_NO DISC_COD
------- -------
1001 D10
1002 D25
1003 <null>
1004 D10
IM_INV Table
ITEM_NO LOC QTY
------- ------- ------
1001 01 5
1001 02 4
1002 01 0
1002 02 0
1003 01 5
1003 02 0
1004 01 0
1004 02 0
After, I run the query, we would like the values in the IM_ITEM table to look as follows:
IM_ITEM Table
ITEM_NO DISC_COD
------- -------
1001 D10
1002 <null>
1003 <null>
1004 <null>
Can someone help me with the SQL command to accomplish this?
Regards,
I would like to update the column in one table based on the results of a query from another table.
I have two tables IM_ITEM and IM_INV tables. In the IM_INV table I would like to sum up the location quantities for each item. If the quantity is zero, I would like to set the DISC_COD to null for that item.
So for example, the tables contents are as follows:
IM_ITEM Table
ITEM_NO DISC_COD
------- -------
1001 D10
1002 D25
1003 <null>
1004 D10
IM_INV Table
ITEM_NO LOC QTY
------- ------- ------
1001 01 5
1001 02 4
1002 01 0
1002 02 0
1003 01 5
1003 02 0
1004 01 0
1004 02 0
After, I run the query, we would like the values in the IM_ITEM table to look as follows:
IM_ITEM Table
ITEM_NO DISC_COD
------- -------
1001 D10
1002 <null>
1003 <null>
1004 <null>
Can someone help me with the SQL command to accomplish this?
Regards,