Hi Sergei,
this is my Runable class for testing query :
Query query = new query(queryStr(MyQuery));
QueryRun queryRun = new QueryRun(query);
CustTable CustTable;
CustBankAccount CustBankAccount;
DirPersonName DirPersonName;
ContactPerson ContactPerson;
while(queryRun.next())
{
CustTable = queryRun.get(tableNum(CustTable));
ContactPerson = queryRun.get(tableNum(ContactPerson));
}
I just remove the other tables, so only Custtable to ContactPerson, and turns out it is because of the data. While the relation between this two table is field ContactPersonId in both tables, in CustTable, this field never populated/updated. I checked there is no customisation for this. And the way I add Contacts for Customer is only in Customer form, go to the Top pane and Add Contact.

Is there some step I missed so that the field ContactPersonId not being updated ?
So basically that is the cause of my query always no record.
Thanks,