我想在mysql中使用子查询返回的结果到另一个查询的IN子句中,我想在oracle数据库中执行类似批量收集one do的操作,但我猜mysql中没有这样的操作
对于ex:
set @features := (select group_concat(apf.featureid ) from
applicationpackagefeature apf ,
feature f,
applicationpackage ap,
applicationpackageapplication apa,
application a
where f.id = apf.featureid
and apf.applicationPackageId = ap.id
and apa.applicationPackageId = ap.id
and apa.applicationId = a.id
and a.platform = 'b'
and a.version = 'a'
and a.name = 'c');我想存储这个查询返回的id,并在delete语句的三个集合中使用它,尽管我使用了group_concat,但它不起作用
delete from applicationpackagefeature where featureid in (
@features
)发布于 2015-11-09 16:58:55
您可以在MySQL中使用Prepared Statements实现这一点:
SET @query = CONCAT('delete from applicationpackagefeature where featureid in (
',@features,')');
PREPARE stmt FROM @query; EXECUTE stmt; DEALLOCATE PREPARE stmt;https://stackoverflow.com/questions/33605476
复制相似问题