I am using mysql Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (x86_64).
This query fails with a
You have an error in your SQL syntax[...]near 'read ASC' message :
SELECT 'messages'.* FROM 'messages' WHERE 'messages'.'user_id' = 2 ORDER BY read ASC;
read column is a
TINYINT(1) value generated by the Rails ActiveRecord interface to store boolean values.
The same action works when switching to postgresql, but i currently have no access to the pg generated queries.
Is there something wrong with the actual query? (maybe i cannot order by a tinyint) or should I file a bug report?
Read is reserve keyword in mysql
you have to add ‘read’ ASC in your query
Answered By – naveen goyal