![]() |
|
Not in yada Not Exists ile Kayıt silme - Baskı Önizleme +- Delphi Can (https://www.delphican.com) +-- Forum: Veri Tabanı (https://www.delphican.com/forumdisplay.php?fid=4) +--- Forum: MySQL (https://www.delphican.com/forumdisplay.php?fid=14) +--- Konu Başlığı: Not in yada Not Exists ile Kayıt silme (/showthread.php?tid=1710) |
Not in yada Not Exists ile Kayıt silme - mcuyan - 21-12-2017 Merhaba arkadaşlar. MySQL 5.7 Innodb kullanıyorum. select * from tablo1 t1 where not exists (Select * from tablo2 t2 where t1.site_id=t2.site_no); Satırı data üretirken: delete from tablo1 t1 where not exists (Select * from tablo2 t2 where t1.site_id=t2.site_no); satırını hata vermesini neye bağlıyorsunuz? ![]() Aşağıdaki hatayı veriyor.. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1 where not exists (Select * from tablo2 t2 where t1.site_id=t2.site_no)' at line 1 Not in yada Not Exists ile Kayıt silme - mad85 - 22-12-2017 Merhaba, Delete fromile başlayan sql cümlelerinde tablolarda alias kullanılmamalı diye biliyorum. delete from tablo1 where not exists (Select * from tablo2 t2 where tablo1.site_id=t2.site_no)şeklinde kullanırsanız düzelecektir. Not in yada Not Exists ile Kayıt silme - mcuyan - 22-12-2017 Merhaba.. Sizinki ile benimki arasında sadece Alias t1 kullanmamışsınız.. Delete de alias kullanılmadığı için mi çalıştı? Cvp: Not in yada Not Exists ile Kayıt silme - vkamadan - 22-12-2017 (22-12-2017, Saat: 13:16)mcuyan Adlı Kullanıcıdan Alıntı: Merhaba.. Sizinki ile benimki arasında sadece Alias t1 kullanmamışsınız.. Merhaba , ek bir bilgi olarak, DELETE cümlelerinde allias kullanabilirsiniz ancak cümleniz şöyle olabilir ; delete t1.* from tablo1 t1 where not exists (Select * from tablo2 t2 where t1.site_id=t2.site_no) burada DELETE cümlesinde from dan önce "*" ifadesini garip bulabilirsiniz ancak JOIN li cümlelerde VTYS nin hangi tablodan sileceğini bu şekilde belirtmeniz gerekir. örn: DELETE hr.* FROM hareket as hr , hesapkart as hk WHERE hk.heskod=hr.heskod bu ifadede 2 farklı tablo var ancak biz hr aliasına sahip hareket tablosundan silme yapmasını belirttik Not in yada Not Exists ile Kayıt silme - mcuyan - 25-12-2017 ilginç.. çok teşekkürler.. |