简体   繁体   中英

How to Fix Error In SQL Query

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM