Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

商品信息查询报错 #85

Closed
mtong0 opened this issue Mar 30, 2023 · 2 comments
Closed

商品信息查询报错 #85

mtong0 opened this issue Mar 30, 2023 · 2 comments

Comments

@mtong0
Copy link

mtong0 commented Mar 30, 2023

SQL: SELECT m.*, u.name unitName, mc.name categoryName, me.bar_code, me.purchase_decimal, me.commodity_decimal, me.wholesale_decimal, me.low_decimal, me.sku FROM jsh_material m LEFT JOIN jsh_material_extend me ON me.tenant_id = 63 AND m.id = me.material_id AND ifnull(me.delete_Flag, '0') != '1' LEFT JOIN jsh_unit u ON u.tenant_id = 63 AND m.unit_id = u.id AND ifnull(u.delete_Flag, '0') != '1' LEFT JOIN jsh_material_category mc ON mc.tenant_id = 63 AND m.category_id = mc.id AND ifnull(mc.delete_Flag, '0') != '1' WHERE m.tenant_id = 63 AND 1 = 1 AND (me.bar_code LIKE ? OR m.name LIKE ? OR m.standard LIKE ? OR m.model LIKE ?) AND ifnull(m.delete_flag, '0') != '1' GROUP BY m.id ORDER BY m.id DESC LIMIT ?, ?
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #24 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'erp.me.bar_code' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #24 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'erp.me.bar_code' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

应该是对应sql(MaterialMapperEx.xml -> selectByConditionMaterial)中group by的列名不全GROUP BY m.id后面加上u.name, mc.name, me.bar_code, me.purchase_decimal, me.commodity_decimal, me.wholesale_decimal, me.low_decimal, me.sku就好了

@jishenghua
Copy link
Owner

jishenghua commented Mar 30, 2023 via email

@mtong0
Copy link
Author

mtong0 commented Mar 30, 2023

好的,谢谢。

@mtong0 mtong0 closed this as completed Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants