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 に答える