Hisoka-X commented on issue #7974:
URL: https://github.com/apache/seatunnel/issues/7974#issuecomment-2454210452

   The core problem is that the filter field in the `where_condition` must 
appear in the result of the subquery. If the where condition is directly 
concatenated to the subquery, incompatibility will occur.
   For example:
   ```
   query: """ SELECT product, SUM(quantity) AS total_quantity
   FROM sales
   WHERE quantity > 10
   GROUP BY product"""
   "where_condition"="where total_quantity = 100"
   ```
   It will become
   
   ```sql
   SELECT product, SUM(quantity) AS total_quantity
   FROM sales
   WHERE quantity > 10
   GROUP BY product where total_quantity = 100
   ```
   This is not a right SQL.
   But it works when use temp table
   ```sql
   SELECT * 
   FROM (
       SELECT product, SUM(quantity) AS total_quantity
       FROM sales
       WHERE quantity > 10
       GROUP BY product
   ) tmp WHERE total_quantity = 100;
   ```
   
   


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