我正在尝试联接数据库中的某些表,但是发现错误。
我使用的是Postgresql-9.6
SELECT
customer_id
, (select identity_card_number from basic_customer bc where bc.customer_id = ba.customer_id ) as identitu_card_number
, (select fullname from customer_pedal cp where cp.customer_id = ba.customer_id ) as fullname
, customer_id
, category_code
, (select is_cif_active_desc from basic_customer bc where bc.customer_id = ba.customer_id ) as is_active
, ba.account_number
, opening_date
, closure_date
, currency_code
, (SELECT balance_date FROM basic_balance bb where bb.account_number = ba.account_number ) as balance_date
, (SELECT balance_amount FROM basic_balance bb where bb.account_number = ba.account_number ) as balance_amount
, (select description from customer_pedal cp where cp.customer_id = ba.customer_id ) as description
FROM basic_account ba
INNER JOIN customer_pedal cp on cp.customer_id = ba.customer_id
WHERE ba.customer_id is not null;
我希望数据中仅包含basic_account和customer_pedal中的客户ID。