Index example: Join selection with a unique-weight sort sequence table
Join selection with a unique-weight sort sequence table (SRTSEQ(*LANGIDUNQ) LANGID(ENU)).
SELECT * FROM STAFF S1, STAFF S2
WHERE S1.JOB = S2.JOB
or the same query using the JOIN syntax.
SELECT *
FROM STAFF S1 INNER JOIN STAFF S2
ON S1.JOB = S2.JOB
When using the OPNQRYF command, specify:
OPNQRYF FILE(STAFF STAFF)
FORMAT(FORMAT1)
JFLD((1/JOB 2/JOB *EQ))
SRTSEQ(*LANGIDUNQ) LANGID(ENU)
The system can use either index HEXIX or index UNQIX for either query.