gpt4 book ai didi

java - mysql查询错误insert joined select

转载 作者:行者123 更新时间:2023-11-29 04:42:46 24 4
gpt4 key购买 nike

您好,我的 mysql 查询有问题我想插入连接选择查询的结果和另一个数据

这是我的查询请检查并告诉我

    INSERT INTO TB_AUTO_BAN    (MEMO,    REG_DATE,    USER_ID,    NAME,    PHONE_NUM    )    VALUES(    'test',    NOW(),    SELECT    a.USER_ID, a.NAME, a.CONTACT_NUM    FROM TB_CONTACT AS a INNER JOIN TB_CONTACT_GROUP AS b     ON a.GROUP_CONTACT_SEQ = b.GROUP_CONTACT_SEQ     WHERE b.USER_ID= 'spark@naver.com' AND b.GROUP_CONTACT_SEQ = 12000)

最佳答案

正确的语法如下

  INSERT INTO TB_AUTO_BAN
(MEMO,
REG_DATE,
USER_ID,
NAME,
PHONE_NUM
)

SELECT
'test',NOW(),
a.USER_ID, a.NAME, a.CONTACT_NUM
FROM TB_CONTACT AS a INNER JOIN TB_CONTACT_GROUP AS b
ON a.GROUP_CONTACT_SEQ = b.GROUP_CONTACT_SEQ
WHERE b.USER_ID= 'spark@naver.com' AND b.GROUP_CONTACT_SEQ = 12000

关于java - mysql查询错误insert joined select,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24952910/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com