dragonsun2005 2016-03-16 06:15
浏览 55
已采纳

如何修复SQL查询中的错误

Error SQL query: Documentation

SELECT * 
FROM tbl_vehicle_details 
INNER JOIN tbl_user, tbl_ride 
ON `tbl_vehicle_details`.`v_u_id` = `tbl_user`.`u_id` AND 
   `tbl_ride`.`r_v_id` =`tbl_vehicle_details`.`v_id` 
LIMIT 0, 25

MySQL said: Documentation

#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 'ON tbl_vehicle_details.v_u_id = tbl_user.u_id AND tbl_ride.r_v_id = ' at line 1

  • 写回答

1条回答 默认 最新

  • douhuang1973 2016-03-16 06:18
    关注

    You are mixing implicit with explicit join syntax. Try this instead:

    SELECT * 
    FROM tbl_vehicle_details 
    INNER JOIN tbl_user
    ON `tbl_vehicle_details`.`v_u_id` = `tbl_user`.`u_id`
    INNER JOIN tbl_ride 
    ON `tbl_ride`.`r_v_id` =`tbl_vehicle_details`.`v_id` 
    LIMIT 0, 25
    

    Note: Usage of LIMIT without an ORDER BY clause results in an arbitrary selection of records as there is no inherent order in an SQL table.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作