diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts index 4a12f5ee4b..be33bb7606 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts @@ -47,9 +47,9 @@ const sqlite3 = { }, 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',