IneverStop opened a new issue, #18487: URL: https://github.com/apache/shardingsphere/issues/18487
## Bug Report ### Which version of ShardingSphere did you use? 5.1.1 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-JDBC ### Problem description Here is my table DDL: ```sql CREATE TABLE `user` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'user id', `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'user name', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; ``` Here is part of pom.xml: ```xml <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.3</version> </dependency> <dependency> <groupId>org.apache.shardingsphere</groupId> <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId> <version>5.1.1</version> </dependency> ``` Here is entity: ```java @Data @TableName("user") public class User { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Long id; private String name; @TableField(exist = false) private long idp; } ``` This mybatis sql works: ```xml <select id="selectOneNoUpdate" resultType="org.example.learn.entity.User"> SELECT id, name, id + 1 as idp FROM user where id = #{id} </select> ``` logs: ``` ==> Preparing: SELECT id, name, id+ 1 as idp FROM user where id = ? ==> Parameters: 1(Long) 2022-06-21 14:16:02.239 INFO 18960 --- [nio-8081-exec-6] ShardingSphere-SQL : Logic SQL: SELECT id, name, id+ 1 as idp FROM user where id = ? 2022-06-21 14:16:02.239 INFO 18960 --- [nio-8081-exec-6] ShardingSphere-SQL : SQLStatement: MySQLSelectStatement(table=Optional.empty, limit=Optional.empty, lock=Optional.empty, window=Optional.empty) 2022-06-21 14:16:02.239 INFO 18960 --- [nio-8081-exec-6] ShardingSphere-SQL : Actual SQL: slave ::: SELECT id, name, id+ 1 as idp FROM user where id = ? ::: [1] <== Columns: id, name, idp <== Row: 1, bee, 2 <== Total: 1 ``` As you can see, I got id、name、idp as I wish. But this mybatis sql not works: ```xml <select id="selectOneNoUpdate" resultType="org.example.learn.entity.User"> SELECT * FROM (SELECT id, name, id + 1 as idp FROM user where id = #{id} ) temp </select> ``` logs: ``` ==> Preparing: SELECT * FROM (SELECT id, name, id + 1 as idp FROM user where id = ? ) temp ==> Parameters: 1(Long) 2022-06-21 14:18:04.824 INFO 7720 --- [nio-8081-exec-4] ShardingSphere-SQL : Logic SQL: SELECT * FROM (SELECT id, name, id + 1 as idp FROM user where id = ? ) temp 2022-06-21 14:18:04.824 INFO 7720 --- [nio-8081-exec-4] ShardingSphere-SQL : SQLStatement: MySQLSelectStatement(table=Optional.empty, limit=Optional.empty, lock=Optional.empty, window=Optional.empty) 2022-06-21 14:18:04.824 INFO 7720 --- [nio-8081-exec-4] ShardingSphere-SQL : Actual SQL: slave ::: SELECT * FROM (SELECT id, name, id + 1 as idp FROM user where id = ? ) temp ::: [1] <== Columns: id, name <== Row: 1, bee <== Total: 1 ``` As you can see, I can not get `idp` How can i fix this problem? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@shardingsphere.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org