【发布时间】:2022-12-18 00:10:08
【问题描述】:
我正在尝试在 postgres 的 SELECT 中嵌入删除操作。尝试了以下命令但它不起作用.. :(
select * from tasks where title ilike '%
Delete from tasks where title ilike `%Re%` returning (
Select title from tasks where title ilike `%smoke%`)%'
TS 中的实际查询看起来像
select * from tasks where title ilike '%${filter}%'
我正在努力适应
Delete from tasks where title ilike '%Re%' returning (
Select title from tasks where title ilike '%smoke%')
代替 '%{filter}%'
我到处都是错误,无法执行操作!
【问题讨论】:
-
所写的
returning子句没有意义。它不接受子查询。您只能指定要返回的列列表。你到底想用它达到什么目的? -
我正在尝试对使用 Nest.js 构建的表单进行 SQL 注入测试。此表单使用 select * from tasks where title like '%${filter}%' 查询后端。这里的过滤器是从前端发送的查询参数
标签: sql postgresql sql-delete