如何在 C-TreeACE SQL 中使用 inner join 删除?

How to delete using inner join in C-TreeACESQL?

我有以下查询,我需要使它在 CTREESQL 中工作,但直到现在都没有成功:

delete c  
from (select col1, col2,right(rtrim(col3),1) as col3 
FROM table
GROUP BY col1, col2,right(rtrim(col3),1)
having COUNT(NULLIF(ltrim(col4), '')) =1 and COUNT(*)=2)d join table c on
c.col1 = d.col1 and c.col2= d.col2 and right(rtrim(c.col3),1) = d.col3
where c.col4 is not  null and LTRIM(c.col4)<>''

以下查询适用于 select 连接:

select c.*  
from (select col1, col2,right(rtrim(col3),1) as col3 
FROM table
GROUP BY col1, col2,right(rtrim(col3),1)
having COUNT(NULLIF(ltrim(col4), '')) =1 and COUNT(*)=2)d join table c on
c.col1 = d.col1 and c.col2= d.col2 and right(rtrim(c.col3),1) = d.col3
where c.col4 is not  null and LTRIM(c.col4)<>''

经过周末的折腾,总算搞定了。

Create Table admin.dupes( col1, col2, col3 )
AS
select col1, col2,right(rtrim(col3),1) as col3 
FROM table
GROUP BY col1, col2,right(rtrim(col3),1)
having COUNT(NULLIF(ltrim(col4), '')) =1 and COUNT(*)=2

delete from table
where 
table.col4 is not  null and LTRIM(table.col4)<>''
and exists (select 1 from dupes d where table.col1 = d.col1 and table.col2= d.col2 and right(rtrim(table.col3),1) = d.col3
)

Drop Table admin.dupes

我无法使用派生的 table/temporary table,因为两者都不起作用。