-
-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Hi,
I want to execute the following SQL statements:
SET @cur_pos = 0;
UPDATE table
SET position = (SELECT (@cur_pos := @cur_pos + 1000))
WHERE tableId = 3570
ORDER BY position DESC;
await connection.queryRunner.executeSelectOneRow('SET @cur_pos = 0');
const newPostion = connection.fragmentWithType('int', 'required').sql`(SELECT (@cur_pos := @cur_pos + 1000))`;
const reorder = await connection.update(table)
.set({
position: newPostion
})
.where(table.tableId.equals(3570))
.customizeQuery({
afterQuery: connection.rawFragment`ORDER BY position DESC`
})
// .orderBy(table.position)
.executeUpdate();
ts-sql-query does not support ORDER BY in an update statement.
It would be great if this could be added.
Please see https://mariadb.com/kb/en/update/ for reference.
This only seems to be supported by MySQL and MariaDB.
Do you plan to integrate user defined variables into the API so I can avoid custom SQL?
Best Regards,
Chris
Metadata
Metadata
Assignees
Labels
No labels