如何将此sql查询转换为liquibase查询
我有这样的桌子如何将此sql查询转换为liquibase查询,sql,database,liquibase,Sql,Database,Liquibase,我有这样的桌子 |-------------------------| | A | B | V | |-------------------------| | 1 | 2 | 5 | |-------------------------| | 1 | 2 | 10 | |-------------------------| | 1 | 2 | 2 | |-----------------
|-------------------------|
| A | B | V |
|-------------------------|
| 1 | 2 | 5 |
|-------------------------|
| 1 | 2 | 10 |
|-------------------------|
| 1 | 2 | 2 |
|-------------------------|
我需要删除所有具有等于nad B值和较低C值的重复行
在运行sql脚本之后,我只需要为每一个等于A和B的列设置一个C值最高的行
|-------------------------|
| 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>
是的,但我认为第二个应该在塔格诺。为什么?这是一个子选择,它形成了整个where语句,因为我无法构建项目,错误是元素的内容必须由格式良好的字符数据或标记组成,这是因为或使用了CDATA节