Delete 2 tables in the same query

Delete 2 tables in the same query

  
How can i delete 2 tables in the same advanced query? Like this:

DELETE {REGISTO_UTILIZADOR},{REQUERENTE}
FROM {REGISTO_UTILIZADOR} LEFT JOIN {REQUERENTE} ON {REGISTO_UTILIZADOR}.[RegistoId]={REQUERENTE}.[RegistoId]
WHERE {REGISTO_UTILIZADOR}.[RegistoId] =@RegistoId

Hi Filipe,

 

Have you thought about changing the delete rule in the reference attribute to delete?

In that case you would only need to delete the records in one entity and the corresponding records in the other entity would also be deleted.

 

Cheers,

Tiago Simões

Yes but in some cases we cant edit the database

Hi Filipe,

 

In that case you should do 2 advanced queries and they will run in the same transaction (all db actions in an request will run in the same transaction unless there is an explicit commit).

 

Cheers,

Tiago Simões