como hacer una consulta de un registro que no esta en una tabla en mysql 1

como hacer una consulta de un registro que no esta en una tabla en mysql

SELECT t1.*
  FROM data_base_ct t1
  LEFT JOIN data_inicio_primera_etapa t2
    ON t2.codigo_ct = t1.codct
 WHERE t2.codigo_ct IS NULL

Here is what the above code is Doing:
1. Create a temporary table called data_inicio_primera_etapa that contains the data you want to keep.
2. Create a temporary table called data_base_ct that contains all the data you want to delete.
3. Create a temporary table called data_base_ct_to_delete that contains all the data you want to delete that is not in the data_inicio_primera_etapa table.
4. Delete the data from the data_base_ct_to_delete table.
5. Drop the temporary tables.

Similar Posts