customer_review/sql/write_note.sql

13 lines
425 B
MySQL
Raw Normal View History

2023-12-04 12:09:51 -05:00
MERGE INTO
rlarp.customer_review w
USING
( SELECT $1 bill_cust, $2 ship_cust, $3::numeric expected, $4 expecteduom) as i ON
i.ship_cust = w.ship_cust
AND i.bill_cust = w.bill_cust
WHEN MATCHED THEN UPDATE SET
newords = i.expected
,newuom = i.expecteduom
WHEN NOT MATCHED THEN
INSERT (bill_cust, ship_cust, newords, newuom)
VALUES (bill_cust,i.ship_cust, i.expected, i.expecteduom)