如何将此 sql 查询转换为 liquibase 查询
how to convert this sql query to liquibase query
我有table这样的
|-------------------------|
| A | B | V |
|-------------------------|
| 1 | 2 | 5 |
|-------------------------|
| 1 | 2 | 10 |
|-------------------------|
| 1 | 2 | 2 |
|-------------------------|
我需要删除所有具有等于 A 和 B 值且 C 值较低的重复行
在 运行 sql 脚本之后,我只需要这一行具有最高 C 值,每个等于 A 和 B 列
|-------------------------|
| A | B | V |
|-------------------------|
| 1 | 2 | 10 |
|-------------------------|
这是我正在使用的 sql 查询
delete from t where t.v < (select max(t2.v) from t t2 where t2.a = t.a and t2.b = t.b);
如何将其转换为 liquibase 查询
你的意思是这样的?
<changeSet author="liquibase-docs" id="delete-example">
<delete catalogName="cat"
schemaName="public"
tableName="t">
<where>t.v < (select max(t2.v) from t t2 where t2.a = t.a and t2.b = t.b)</where>
</delete>
</changeSet>
我有table这样的
|-------------------------|
| A | B | V |
|-------------------------|
| 1 | 2 | 5 |
|-------------------------|
| 1 | 2 | 10 |
|-------------------------|
| 1 | 2 | 2 |
|-------------------------|
我需要删除所有具有等于 A 和 B 值且 C 值较低的重复行
在 运行 sql 脚本之后,我只需要这一行具有最高 C 值,每个等于 A 和 B 列
|-------------------------|
| A | B | V |
|-------------------------|
| 1 | 2 | 10 |
|-------------------------|
这是我正在使用的 sql 查询
delete from t where t.v < (select max(t2.v) from t t2 where t2.a = t.a and t2.b = t.b);
如何将其转换为 liquibase 查询
你的意思是这样的?
<changeSet author="liquibase-docs" id="delete-example">
<delete catalogName="cat"
schemaName="public"
tableName="t">
<where>t.v < (select max(t2.v) from t t2 where t2.a = t.a and t2.b = t.b)</where>
</delete>
</changeSet>