MySQL database table field using keywords such as desc error and resolution method

Source: Internet
Author: User
<!--  desc is a key word for the MySQL database, and using it as a field name will error-

<sql id= "Base_column" >id,mol,ip,port,name,t.desc,maxac,maxi,mini,maxw,status
</sql><!--Query List- <select id= "gettht" resultmap= "Baseresultmap" parametertype= "Thigdo" > Select <include refid= "Base_column"/> from t_sys_thorfd t order by status Desc <include refid= "where"/ > </select>





A simple query statement has been an error in the location of Desc, at first thought it was
ORDER BY Status Desc error, check multiple times, suspected DESC is the name of the field to blame, after verifying that, DESC is often used as a field name to identify the meaning of the  description
The solution is to use the above curve to salvation, or replace the field name.

Another way to do this is to add an anti-quote marker where you want to use the keyword, for example

<if test= "desc! = null and desc!=" ">
' Desc ',
</if>

MySQL database table field using keywords such as desc error and resolution method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.