在我的客户表中,有一行名为 *inactive_status*,它始终设置为“活动”。除非 *is_paid*(位于Billing_Info表中)设置为 0。我需要使用 Update 命令,但无法弄清楚。这是我到目前为止所拥有的:
UPDATE Customer
SET inactive_status = 'INACTIVE'
WHERE
(SELECT is_paid
FROM Billing_Info
WHERE billing_info.is_paid = 0);
DDL:
CREATE TABLE billing_info (
billing_info_id INT,
bill_day_id INT,
is_past_due NUMBER(1,0) NOT NULL,
date_last_paid DATE,
is_paid_this_month NUMBER(1,0) NOT NULL,
paid_amount DECIMAL(6,2) NOT NULL,
bill_amount DECIMAL(6,2) NOT NULL,
CONSTRAINT billing_info_id_pk PRIMARY KEY(billing_info_id) );
CREATE TABLE customer (
customer_id INT,
join_date DATE NOT NULL,
billing_info_id INT NOT NULL,
inactive_status VARCHAR2(25),
contact_info_id INT NOT NULL,
CONSTRAINT customer_id_pk PRIMARY KEY (customer_id) );
有什么建议么?