diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts index babad78588..9aedd96097 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/mysql.ts @@ -28,9 +28,9 @@ const mysql2 = { }, RIGHT: (args: MapFnArgs) => { return args.knex.raw( - `SUBSTR(${args.fn(args.pt.arguments[0])},-${args.fn( + `SUBSTR(${args.fn(args.pt.arguments[0])}, -(${args.fn( args.pt.arguments[1] - )})${args.colAlias}` + )}))${args.colAlias}` ); }, MID: 'SUBSTR',