这是我的代码:
UPDATE
Table_A
SET
Table_A.chat_id = Table_B.chat_id
FROM
ac_messages AS Table_A
INNER JOIN ac_contacts AS Table_B
ON (Table_A.m_to = Table_B.users_id AND Table_A.m_from = Table_B.contacts_id) OR (Table_A.m_from = Table_B.users_id AND Table_A.m_to = Table_B.contacts_id)
WHERE
(Table_A.m_to = Table_B.users_id AND Table_A.m_from = Table_B.contacts_id) OR (Table_A.m_from = Table_B.users_id AND Table_A.m_to = Table_B.contacts_id)
这是一个sytanx错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM
ac_messages AS Table_A
INNER JOIN ac_contacts AS Table_B
...' at line 5
我的目标是将我为聊天定义的唯一 ID 传递给用户之间的消息。