当前使用版本(必填,否则不予处理)
3.5.2
该问题是如何引起的?(确定最新版也有问题再提!!!)
Page
<select id="find" resultType="com.shihua.scmserver.vo.CustomerInformationFindRsqVO">
select
b.id,
d.customer_name,
b.customer_code,
grade,
(select top 1 city_name from scm_city_code c where c.province_code = b.province_code) provinceName,
province_code ,
(select city_name from scm_city_code c where b.province_code=c.province_code and c.city_code = b.city_code) cityName,
city_code
from scm_customer_information b left join scm_customer_code d on b.customer_code = d.code
<where>
b.deleted = 1
<if test=" vo.customerName != null and vo.customerName != ''">
and customer_name = 'ggg'
</if>
</where>
order by b.id desc
</select>
重现步骤(如果有就写完整)
报错信息
SQL: SELECT COUNT(*) AS total FROM scm_customer_information b WHERE b.deleted = 1 AND customer_name = 'ggg'
Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 列名 'customer_name' 无效。
; bad SQL grammar []; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: 列名 'customer_name' 无效。] with root cause com.microsoft.sqlserver.jdbc.SQLServerException: 列名 'customer_name' 无效。
Comment From: miemieYaho
加上表别名.