Superainbower opened a new issue #11437:
URL: https://github.com/apache/shardingsphere/issues/11437


   ## Question
   
   **For English only**, other languages will not accept.
   Hi, i find the result isn't right in Row to Column scenario (shardingsphere 
jdbc 5.0.0-beta)
   
   Here is my data in mysql ( table sharding by time)
   
![image](https://user-images.githubusercontent.com/35786966/126478735-1542d153-eac3-4bd7-86af-abfefb8fe929.png)
   
   SQL like this:
   select car_no,
           ifnull(sum( CASE WHEN type = '1' THEN cnt END ),0) AS type1,
           ifnull(sum( CASE WHEN type = '2' THEN cnt END ),0) AS type2 
   from (
             select car_no,type,count( * ) AS cnt  from  tb_warning_info where
          begin_time >= #{start} and begin_time <= #{end} 
             group by car_no,type
   ) a  group by car_no
   
   When #{start} >= 2021-01-01 00:00:00 and #{end} <= 2021-12-31 23:59:59, the 
result is right
   [{"type2":0,"car_no":"云EXXXXX","type1":1}]
   When #{start} >= 2020-01-01 00:00:00 and #{end} <= 2020-12-31 23:59:59, the 
result is right
   [{"type2":1,"car_no":"云EXXXXX","type1":0}]
   
   But when #{start} >= 2020-01-01 00:00:00 and #{end} <= 2021-12-31 23:59:59
   the result must be [{"type2":1,"car_no":"云EXXXXX","type1":1}], but got 
[{"type2":0,"car_no":"云EXXXXX","type1":1}]
   i really think it should return 
[{"type2":0,"car_no":"云EXXXXX","type1":1},{"type2":1,"car_no":"云EXXXXX","type1":0}]
   i can calculate by myself
   so what should i do in this scenario?
   Before asking a question, make sure you have:
   
   - Googled your question.
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to