futureDBA
asked on
Conditional Join
Hello experts,
I have this conditional join right here, thanks to the help of the community yesterday
While this achieves what I am trying to do when i use the variable 'SOME ITEM'
I need this to be accomplished on all items in that column that match the above statement. I have tried different variations of the above and it does not work
so lets say in columns, IN_ITEM and t_ITEM have 'SOME ITEM' and other items (eg, 'some item2' 'some item3' etc etc
i want this to happen to all rows where column data matches
I have this conditional join right here, thanks to the help of the community yesterday
INSERT INTO shipping(sdate, rec_wh, shipping, item)
SELECT ship_date, receiver_warehouse, ord, custitemcode
FROM wag
WHERE custitemcode = 'SOME ITEM'
AND (SELECT SUM(ord)
FROM recinc
WHERE in_item = 'SOME ITEM') = (SELECT SUM("tSHIPPING")
FROM trans
WHERE "tITEM" = 'SOME ITEM');
While this achieves what I am trying to do when i use the variable 'SOME ITEM'
I need this to be accomplished on all items in that column that match the above statement. I have tried different variations of the above and it does not work
so lets say in columns, IN_ITEM and t_ITEM have 'SOME ITEM' and other items (eg, 'some item2' 'some item3' etc etc
i want this to happen to all rows where column data matches
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You sir, perfect
SUM("tSHIPPING")
WHERE "tITEM" = wag.custitemcode);
otherwise oracle will treat them as columns with names TSHIPPING and TITEM which don't exist in your table
also note, if you still want to apply a filter to the wag table, then apply it there by adding a clause like this to end of the query...
AND wag.custitemcode in ('SOMEITEM','some_other_it