Cause: : Column 'id' in field list is ambiguous
出现异常的原因:
(多表联查查询出现的问题)列'ID'在字段列表中重复,其实就是两张表有相同的字段,但是使用时表字段的名称前没有加表名,导致指代不明
解决方案:加上别名就可以了。
### Cause: : Column 'id' in field list is ambiguous
; Column 'id' in field list is ambiguous; nested exception is : Column 'id' in field list is ambiguous
at (:87)
at (:72)
at (:81)
at (:73)
at $(:446)
at .$(Unknown Source)
at (:230)
at (:139)
at (:76)
at (:59)
at .$(Unknown Source)
at (:27)
at (:59)
at $$FastClassBySpringCGLIB$$(<generated>)
at (:218)
at $(:749)
at (:163)
at (:119)
at (:186)
at $(:688)
at $$EnhancerBySpringCGLIB$$(<generated>)
at .invoke0(Native Method)
at (:62)
at (:43)
at (:498)
at (:190)
at (:138)
at (:104)
at (:892)
at (:797)
at (:87)
at (:1039)
at (:942)
at (:1005)
at (:897)
at (:634)
at (:882)
at (:741)
at (:231)
at (:166)
at (:53)
at (:193)
at (:166)
at (:84)
at (:193)
at (:166)
at (:53)
at (:193)
at (:166)
at (:96)
at (:107)
at (:193)
at (:166)
at (:123)
at (:193)
at (:166)
at (:99)
at (:107)
at (:193)
at (:166)
at (:92)
at (:107)
at (:193)
at (:166)
at (:93)
at (:107)
at (:193)
at (:166)
at (:200)
at (:107)
at (:193)
at (:166)
at (:200)
at (:96)
at (:490)
at (:139)
at (:92)
at (:74)
at (:343)
at .http11.(:408)
at (:66)
at $(:836)
at $(:1747)
at (:49)
at (:1142)
at $(:617)
at $(:61)
at (:748)
Caused by: : Column 'id' in field list is ambiguous
at (:117)
at (:97)
at (:122)
at (:955)
at (:372)
at .preparedStatement_execute(:3409)
at .preparedStatement_execute(:619)
at .preparedStatement_execute(:3407)
at .preparedStatement_execute(:440)
at .preparedStatement_execute(:3407)
at (:167)
at (:498)
at .invoke0(Native Method)
at (:62)
at (:43)
at (:498)
at (:59)
at .$(Unknown Source)
at (:63)
at (:79)
at (:63)
at (:326)
at (:156)
at (:109)
at (:201)
at (:113)
at (:61)
at .$(Unknown Source)
at (:148)
at (:141)
at .invoke0(Native Method)
at (:62)
at (:43)
at (:498)
at $(:433)
... 83 common frames omitted
09:10:51 [http-nio-8082-exec-2] DEBUG - Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/json, application/*+json]
09:10:51 [http-nio-8082-exec-2] DEBUG - Writing [{errno=502, errmsg=系统内部错误}]
09:10:51 [http-nio-8082-exec-2] WARN - Resolved [:
### Error querying database. Cause: : Column 'id' in field list is ambiguous
### The error may exist in org/linlinjava/litemall/db/dao/
### The error may involve -Inline
### The error occurred while setting parameters
### SQL: select count(0) from (SELECT id, user_id, order_sn, order_status, aftersale_status, consignee, mobile, address, message, goods_price, freight_price, coupon_price, integral_price, groupon_price, order_price, actual_price, pay_id, pay_time, pay_type, ship_sn, ship_channel, ship_time, refund_amount, refund_type, refund_content, refund_time, confirm_time, comments, end_time, add_time, update_time, deleted, remark, is_sigin, signin_num FROM `litemall_order_goods` AS og LEFT JOIN `litemall_order` AS lo ON og.`order_id` = lo.`id` WHERE goods_name LIKE CONNECT('%',?,'%') AND lo.`order_status` = ? AND lo.`user_id` = ?) tmp_count