Database Postgres SQL:如何删除表1中category=x的行(但category在表2中定义)?
我有一个Postgres数据库。我试图根据表2中表示的条件删除表1中的行 表1: id、对象id、时间、操作类型 表2: 对象id、对象名称、对象类别Database Postgres SQL:如何删除表1中category=x的行(但category在表2中定义)?,database,postgresql,join,Database,Postgresql,Join,我有一个Postgres数据库。我试图根据表2中表示的条件删除表1中的行 表1: id、对象id、时间、操作类型 表2: 对象id、对象名称、对象类别 我想删除表1中object_category=x的所有行。您可以使用中的语句和delete: delete from table1 where object_id in (select object_id from table2 where table2.object_category = x) 您可以将in语句中的与删除一起使用: d
我想删除表1中object_category=x的所有行。您可以使用
中的语句和delete
:
delete from table1
where object_id in (select object_id from table2 where table2.object_category = x)
您可以将in
语句中的与删除一起使用:
delete from table1
where object_id in (select object_id from table2 where table2.object_category = x)
您可以将in
语句中的与删除一起使用:
delete from table1
where object_id in (select object_id from table2 where table2.object_category = x)
您可以将in
语句中的与删除一起使用:
delete from table1
where object_id in (select object_id from table2 where table2.object_category = x)
备选方案:
delete from table1
using table2
where table1.object_id = table2.object_id and object_category = x;
备选方案:
delete from table1
using table2
where table1.object_id = table2.object_id and object_category = x;
备选方案:
delete from table1
using table2
where table1.object_id = table2.object_id and object_category = x;
备选方案:
delete from table1
using table2
where table1.object_id = table2.object_id and object_category = x;