Delete with Join in MySQL

后端 未结 14 1039
鱼传尺愫
鱼传尺愫 2020-11-22 06:18

Here is the script to create my tables:

CREATE TABLE clients (
   client_i INT(11),
   PRIMARY KEY (client_id)
);
CREATE TABLE projects (
   project_id INT(         


        
14条回答
  •  一生所求
    2020-11-22 07:15

    -- Note that you can not use an alias over the table where you need delete

    DELETE tbl_pagos_activos_usuario
    FROM tbl_pagos_activos_usuario, tbl_usuarios b, tbl_facturas c
    Where tbl_pagos_activos_usuario.usuario=b.cedula
    and tbl_pagos_activos_usuario.cod=c.cod
    and tbl_pagos_activos_usuario.rif=c.identificador
    and tbl_pagos_activos_usuario.usuario=c.pay_for
    and tbl_pagos_activos_usuario.nconfppto=c.nconfppto
    and NOT ISNULL(tbl_pagos_activos_usuario.nconfppto)
    and c.estatus=50
    

提交回复
热议问题