Covert SQL to code for Column Expressions
Hi everyone, I have this data as attached. I wrote SQL for drafting first and now I want to bring it to work on KNIME but I don’t know how to convert it into Column Expressions (if any node works).
Here is my SQL, please advise me to change it into KNIME:
WITH cte AS( SELECT* FROM test (1).test – My data attached ORDER BY user_name, Date DESC) SELECT c1.user_name, c1.Date, c1. amount, c1. Total. CASE WHEN MAX(c1.amount)-SUM(c2.total) >=0 THEN c1.Total WHEN MAX(c1.amount)-SUM(c2.total)=0 THEN c1. Total + (MAX(c1.amount))-SUM(c2.total)) ELSE 0 END AS refund FROM cte c1 JOIN cte c2 ON c1.username = c2.username AND c1.Date GROUP BY c1.user_name, c1.Date, c1.amount, c1.Total ORDER BY c1.user_name, c1.Date DESC