zhao-en commented on issue #18207:
URL: 
https://github.com/apache/shardingsphere/issues/18207#issuecomment-1211713366

   
   
   
   > Can you give me a simple runnable demo to investigate this issue,thank you.
   
   when the 'distinct' and 'group by' are used in one sql , the 'group by' will 
be replace by 'order by ' after creating  ShardingSphere-SQL will 
   case : 
    Logic SQL: SELECT COUNT(DISTINCT 
DATE_FORMAT(LEFT(b.create_date,13),'%Y-%m-%d %H')) hourNum, date
           FROM table_name b
           where (b.p_id,b.d_id) IN
                (  
                   (?, ?)
                ) 
            
            
               and b.create_date  >=  ?
            
            
               AND b.create_date  <  ?
           GROUP BY date,d_id
   
   
   Actual SQL: SELECT COUNT(DISTINCT 
DATE_FORMAT(LEFT(b.create_date,13),'%Y-%m-%d %H')) hourNum, date
           FROM table_name_1 b
           where (b.p_id,b.d_id) IN
                (  
                   (?, ?)
                ) 
            
            
               and b.create_date  >=  ?
            
            
               AND b.create_date  <  ?
   ORDER BY DATE ASC,deviceId ASC 


-- 
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