我有一个 Delphi 应用程序,在其中显示已通过查询玩过的游戏列表,如下所示:
select g.*, gt.id, gt.descr
from GAMES g
inner join game_types gt on gt.id = g.game_type
order by game_date DESC
当我单击 DBNavigator 中的删除按钮时,game_types 表中的联接记录也会被删除。这是一个问题,因为许多其他游戏可能属于同一类型。
我需要做什么才能只删除游戏而不删除游戏类型?
最佳答案
您需要使用Unique Table动态属性
ADOQuery1.Properties['Unique Table'].Value := 'GAMES';
If the Unique Table dynamic property is set, and the Recordset is the result of executing a JOIN operation on multiple tables, then the Delete method will only delete rows from the table named in the Unique Table property.
关于sql - ADODataSet 从连接表中删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7981718/