📜  使用条件 postgres 插入 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:17.504000             🧑  作者: Mango

代码示例1
WITH get_cust_code_for_cust_id AS (
    SELECT cust_code FROM cust WHERE cust_id=11
)

INSERT INTO public.table_1(
    cust_code, issue, status, created_on)
    VALUES (SELECT cust_code FROM get_cust_code_for_cust_id, 'New Issue', 'Open', current_timestamp)