Topic: deletion of Max(id) record

Can any one tell how to delete Max value of a record in a field?

Re: deletion of Max(id) record

SQLEXECUTE(DELETE TABLE WHERE  ID = (SELECT MAX(ID)  FROM TABLE));

Re: deletion of Max(id) record

Thank you pavienko. Can you tell how to delete a data in foreign key?

Re: deletion of Max(id) record

unforgettable wrote:

Thank you pavienko. Can you tell how to delete a data in foreign key?

the foreign key is equal to the id of the related table. show your architecture and then I can help
внешний ключ равен идентификатору связанной таблицы. покажи свою архитектуру и тогда я смогу помочь

Re: deletion of Max(id) record

unforgettable wrote:

Thank you pavienko. Can you tell how to delete a data in foreign key?

Foreign key control is to prevent deletion of data referenced from other tables. This is an element of the data integrity control system.


If you need to delete a referencing reference record, there are three solutions in DVBM when setting up a foreign key:


1. Make the field optional. Then, before deleting the reference record, it is necessary to write the value NULL in such a field
2. Enable cascading deletion. Then, when a reference record is deleted, all records that had a connection with it will be deleted.
3. Before deleting an entry in the directory, delete all entries associated with a foreign key yourself.


What kind of removal method do you need?

Визуальное программирование: блог и телеграм-канал.

Re: deletion of Max(id) record

Hi k245,
          I think need second method. Can you help?

7 (edited by k245 2022-06-17 12:00:37)

Re: deletion of Max(id) record

When creating a connection, set a checker

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=8773&download=0

Post's attachments

Attachment icon img-2022-06-17-14-58-35.png 10.41 kb, 65 downloads since 2022-06-17 

Визуальное программирование: блог и телеграм-канал.

Re: deletion of Max(id) record

cascade check? It will enable to delete all foreign keys concerned date in all table having foreign keys?

Re: deletion of Max(id) record

unforgettable wrote:

cascade check? It will enable to delete all foreign keys concerned date in all table having foreign keys?

Yes ))

Визуальное программирование: блог и телеграм-канал.