mysql - 连接的正确语法

标签 mysql phpmyadmin

我的 phpmyadmin 语法有问题。这是我的查询:

SELECT
    CONCAT_WS(',', visitor_name, visitor_email, visitor_phone) AS visitor_info,
    session_geoip_country,  
    session_geoip_city,
    visitor_chats_count,
    agents_names, 
    chat_id,
    SUBSTRING( visitor_description, 1, 100 ) AS Manager_note
FROM
    client_jivo_chat_finished
INNER JOIN
    client_jivo_chat_finished_messages.timestamp, client_jivo_chat_finished_messages.message 
ON
    client_jivo_chat_finished_messages.chat_id = client_jivo_chat_finished.chat_id

错误是:

"#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON client_jivo_chat_finished_messages.chat_id = client_jivo_chat_finished.chat_i' at line 8"

最佳答案

当您连接表列时,您的语法不正确。这是修改后的版本。希望这有效。

SELECT
    CONCAT_WS(',', visitor_name, visitor_email, visitor_phone) AS visitor_info,
    session_geoip_country,  
    session_geoip_city,
    visitor_chats_count,
    agents_names, 
    chat_id,
    SUBSTRING( visitor_description, 1, 100 ) AS Manager_note
FROM
    client_jivo_chat_finished
INNER JOIN
    client_jivo_chat_finished_messages 
ON
    client_jivo_chat_finished_messages.chat_id = client_jivo_chat_finished.chat_id

您应该将两个表连接到一列上。只需删除这部分即可。

内连接 client_jivo_chat_finished_messages.timestamp,client_jivo_chat_finished_messages.message

关于mysql - 连接的正确语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45344073/

相关文章:

java - JPA NamedQuery 选择特定列并返回类类型

mysql - 需要在不同的域中但使用不同的数据库部署相同的 Codeigniter 代码

mysql - 使用变量作为名称删除外键

mysql - SQL 将一个表数据连接到其他表

php - PHP 中的 CRUD 操作...在 edit.php 中出现错误

mysql - 从作为服务器的 phpmyadmin 转移到作为服务器的谷歌云平台?

c# - 如何远程调用MySQL中的用户授予所有权限?

mysql - 在 sql 字符串中使用 bash 参数的脚本问题

mysql - 基于巧妙的常见查询的 SQL 移动平均线行不通

android - 从 android 向 mysql 插入值