# 1064 - You have an error in your SQL syntax;

0

There are some sales that no longer exist and I want to delete the installments that were made with those nonexistent sales, my code was this:

DELETE Abonos_Creditos 
FROM Abonos_Creditos ac
LEFT JOIN Venta_Gas vg
ON ac.id_credito=vg.idVenta
WHERE ac.id_credito is null;

And I get the following error:

  

1064 - 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 '' at line 1

Does anyone know what is the correct way to execute this sentence?

    
asked by Root MH 10.01.2018 в 01:31
source

1 answer

0

The correct syntax is:

  

DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name       [PARTITION (partition_name [ partition_name] ...)]       [WHERE where_condition]       [ORDER BY ...]       [LIMIT row_count]

The name of the table only goes after the "FROM" leaving:

DELETE FROM Abonos_Creditos ac
LEFT JOIN Venta_Gas vg
ON ac.id_credito=vg.idVenta
WHERE ac.id_credito is null;
    
answered by 10.01.2018 в 02:31