MySQL Query fails. Error message does not show my full query--cuts off at string -
when attempt run following query in phpmyadmin or directly in cli,
delete mdl_enrol n1 n1.id > ( select n2.id mdl_enrol n2 n2.enrol = "database" , n1.id > n2.id , n2.courseid = n1.courseid ) , n1.enrol = "database"
i following error message:
#1064 - have error in sql syntax; check manual corresponds mariadb server version right syntax use near 'n1 n1.id > (select n2.id mdl_enrol n2 n2.enrol = "da' @ line 1
if run command select * works fine , returns right number of rows.
why keep cutting off partway through string "database"?
as mentioned in comments, mysql doesn't return whole query in error message. , don't need know query submitting (if done e.g. via php, "echo" query before executing). mysql returns query first character caused error.
in case, error in ... mdl_enrol
n1
...
. according mysql manual, in delete
syntax, not allowed specify table aliases in select
queries. have rewrite query without n1
alias , use full table name mdl_enrol
.
Comments
Post a Comment