带有子查询的 Liquibase where 子句

Liquibase where clause with sub query

是否可以在不使用 <sql> 标签的情况下在 liquibase 中编写子查询

假设我们有以下表格:

Table Cars:
  CarID      int
  CarName    nvarchar(100)

Table Drivers:
  DriverID   int
  DriverName nvarchar(100)

Table CarDrivers:
  CarID      int
  DriverID   int

例子

<delete tableName="CarDrivers">
    <where>DriverID in select driver.DriverID from Drivers driver where driver.DriverName = 'John Doe'</where>
</delete>

是否可以在 liquibase <where> 标签内计算 select driver.DriverID from Drivers driver where driver.DriverName = 'John Doe' 这样的子查询?

我想你可以这样试试:

<delete tableName="CarDrivers">
    <where>driverId IN (SELECT driverId FROM Drivers WHERE driverName IN ('John', 'Jack'))</where>
</delete>