我有两个表,table1(字段:玩家,Insurentsid)和表2。

如何从表2确定如果玩家和InstractId与彼此有关?

我的意思是哪个球员与哪个保险公司协议...

我知道我应该在表中覆盖方法(哪一个?),并使用table1存在方法来使其工作,但我不知道如何做到这一点。

有帮助吗?

解决方案

我不确定我理解正确,但你在表2上创建下一个方法

public boolean existInTable1()
{
    table1 t;
    ;
    select recid from t where t.playerid == this.playerid && t.insuranceid == this.insuranceid;

    return (t.recid !== 0);
}
.

以及代码中的某个位置:

table2 t2;
;
select t2;
if(t2.existInTable1()) ...
.

更新

当然,如果您在表1上有存在的方法,则可以重写如此:

public boolean existInTable1()
{
    ;
    return table1::exist(this.playerid, this.insuranceid);
}
.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top