Mysql的sql,查询问题


This works fine in mysql, but sql fails in n8n

Hey @zzdgaoyan hope all is good. Welcome to the community.

The offset appears to be a string in the parameters

it should be a number, like in the manual executions on the right:

thank you for response.
How do you solve for 0 as a int.This question has been bothering me

Just tried myself and it appears that n8n is stubbornly making the LIMIT a string.
If you are ok with this you technically could just inject the value to the query. You know about the consequences, so only do that if you understand the risks.

SELECT * 
FROM n8ntest
WHERE number > {{ $json.num }}
LIMIT {{ $json.limit }}
OFFSET {{ $json.offset }};

Interestingly parametrization doesn’t work only if you set the limit to 0. Any other value works well. Consider opening a bug for this.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.