0

sql 块工作正常:

select * from aciktan_atama_tercihler LEFT OUTER JOIN (SELECT MIN(t.eklenme_tarihi) as row_id,
                                                              t.tcno,
                                                              t.hastane_kodu,
                                                              t.tercih_sira
                                                         FROM aciktan_atama_tercihler t
                                                        where t.silindi = '0'
                                                        GROUP BY tcno,
                                                                 hastane_kodu,
                                                                 tercih_sira) KeepRows ON aciktan_atama_tercihler.eklenme_tarihi = KeepRows.row_id
 WHERE KeepRows.row_id IS NULL
   and aciktan_atama_tercihler.silindi = '0'

但是,如果我将其更改为如下所示的删除,则会出现“ORA-00933:Sql 命令未正确结束”错误,我该如何解决?:

delete from aciktan_atama_tercihler LEFT OUTER JOIN (SELECT MIN(t.eklenme_tarihi) as row_id,
                                                              t.tcno,
                                                              t.hastane_kodu,
                                                              t.tercih_sira
                                                         FROM aciktan_atama_tercihler t
                                                        where t.silindi = '0'
                                                        GROUP BY tcno,
                                                                 hastane_kodu,
                                                                 tercih_sira) KeepRows ON aciktan_atama_tercihler.eklenme_tarihi = KeepRows.row_id
 WHERE KeepRows.row_id IS NULL
   and aciktan_atama_tercihler.silindi = '0'
4

1 回答 1

1

假设您要从aciktan_atama_tercihler表中删除记录:

DELETE FROM aciktan_atama_tercihler
 WHERE ROWID IN (SELECT aciktan_atama_tercihler.rowid
                   FROM aciktan_atama_tercihler  
        LEFT OUTER JOIN (SELECT MIN(t.eklenme_tarihi) as row_id,
                                t.tcno,
                                t.hastane_kodu,
                                t.tercih_sira
                           FROM aciktan_atama_tercihler t
                          WHERE t.silindi = '0'
                       GROUP BY tcno,
                                hastane_kodu,
                                tercih_sira) KeepRows ON aciktan_atama_tercihler.eklenme_tarihi = KeepRows.row_id
     WHERE KeepRows.row_id IS NULL
       and aciktan_atama_tercihler.silindi = '0')
于 2013-02-13T20:39:03.130 回答