Two Table Equijoin
- Last Updated: May 12, 2026
- 1 minute read
- OpenAccess SDK
- Version 8.1
- Documentation
SELECT * FROM emp, dept
WHERE emp.deptno = dept.deptno
AND(emp.name = 'Sue' AND emp.deptno = 55) OR emp.ename = 'Mark'
For the above query, the IP execute is called to execute a query on Table EMP. The following shows how the IP can determine the conditions and build the results:
-
Check the Process Order of the table being processed using
dam_getInfo(DAM_INFO_QUERY_PROCESS_ORDER), and get the join size usingdam_getInfo(DAM_INFO_JOIN_QUERY_SIZE). In this case, JOIN_QUERY_SIZE will be 2 and QUERY_PROCESS_ORDER will be 0. -
The IP will call
dam_describeTableByProcessOrder()to get details of each table in the query.dam_describeTableByProcessOrder (iTableProcessOrder=0)will returnEMPtable information and the TableNum ofEMPtable will be returned as 0.dam_describeTableByProcessOrder(iTableProcess Order=1)will return DEPT table information and the TableNum of DEPT table will be returned as 1.
-
The IP can begin to get the search condition (filter condition) on each of the tables.
-
dam_getTableSearchExp(iTableNum=0)returns:SearchExpression: (emp.name = 'Sue' AND emp.deptno = 55) OR emp.ename = 'Mark'Join Expression: NULLJoinType: N/A -
dam_getTableSearchExp(iTableNum=1)returns:SearchExpression: NULLJoinType: SQL_JOIN_OLD_STYLE implying INNER JOINJoin Expression: dept.deptno = emp.deptno
-
-
The IP can then build results for
EMPtable and pushdown join rowset for correspondingDEPTtable. -
If it only builds results for
EMPtable, the EXECUTE function of the IP is called for matchingDEPTrecords. In this case, to get the column values for each of the join columns in the Join Expression, the IP can calldam_getJoinColValue(hstmt, iTableNum, iColumnNum, int *piXoType, void *pColData, int *piColDataLen)