Common Table Expressions not working for MySQL data source

Hi,

When I use a CTE in a query with a MySQL data source. It doesn’t work.
Just returns

affectedRows: 0

1 Like

Hello! Are you on cloud or self-hosted? If you are self-hosting Appsmith, what version are you using?

Hello, unfortunately the MySQL CTEs queries are failing and this was reported as a bug, you can track it at the following link:[Bug]: MySQL CTEs queries failed. · Issue #19959 · appsmithorg/appsmith · GitHub
As a workaround for this problem you can use this alternative to the CTEs, it provides the same result.

SELECT * FROM (
  SELECT * FROM employees WHERE id = 2
) AS cte_name;