Untitled
unknown
plain_text
2 years ago
1.3 kB
11
Indexable
DROP TABLE IF EXISTS public_test.testing_result;
CREATE TABLE public_test.testing_result (
id int4 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START 1 CACHE 1 NO CYCLE) NOT NULL,
test_date_time timestamp NOT NULL,
test_name text NOT NULL,
test_result bool NOT NULL,
CONSTRAINT testing_result_pkey PRIMARY KEY (id)
);
INSERT INTO public_test.testing_result
(test_date_time, test_name, test_result)
SELECT
current_timestamp as test_date_time,
'test_01' AS test_name,
count(*) = 0 AS test_result
from (
select * from public_test.dm_settlement_report_expected as ex
full join public_test.dm_settlement_report_actual as ac
on ex.id = ac.id
and ex.restaurant_id = ac.restaurant_id
and ex.settlement_year = ac.settlement_year
and ex.settlement_month = ac.settlement_month
and ex.orders_count = ac.orders_count
and ex.orders_total_sum = ac.orders_total_sum
and ex.orders_bonus_payment_sum = ac.orders_bonus_payment_sum
and ex.orders_bonus_granted_sum = ac.orders_bonus_granted_sum
and ex.order_processing_fee = ac.order_processing_fee
and ex.restaurant_reward_sum = ac.restaurant_reward_sum
where ex.id is null or ac.id is null) as T;
select
test_date_time, test_name, test_result
from public_test.testing_result
;Editor is loading...
Leave a Comment