-
Notifications
You must be signed in to change notification settings - Fork 212
Exception: java.sql.SQLIntegrityConstraintViolationException: Column 'created_time' in order clause is ambiguous #268
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
Comments
This is by design. There are too many corner cases with "order by" clauses so we take a very simple approach. Please read the documentation about it here: https://mybatis.org/mybatis-dynamic-sql/docs/select.html There are a couple of solutions:
|
Got it, thank you! |
Is it possible to add an overloaded method for public static <T> SortSpecification sortColumn(SqlColumn<T> column, String tableAlias) {
return SqlBuilder.sortColumn(tableAlias + "." + column.name());
} Then we can use it easier. |
Good idea - I'll commit something like this shortly. |
Very good! |
code:
generated sql:
The tables "item" and "item_img" have the same column "created_time", and the "order by" clause doesn't add table alias as the column's prefix, so it crashed.
The text was updated successfully, but these errors were encountered: