Topic: Sampling of the conditional data of two tables
Help to understand please, I struggle with an output of unique fields from one table with their title from another
There are two tables PAYFINPLAN (contains the information on all payments - ten thousand records), CLASSIFY (decryption of the codes - too some thousand).
It is necessary to select the unique codes of a type of payment and its name
I use request of a type:
SELECT DISTINCT CODE8 FROM BUDGET_MASTER.PAYFINPLAN WHERE ("YEAR" = ' 2017 ')
The unique codes of types of payments quickly enough but when I try to connect two tables that sampling are selected happens very slowly within one minute.
SELECT DISTINCT PAYFINPLAN.CODE8 AS CODE, CLASSIFY.NAME FROM BUDGET_MASTER.PAYFINPLAN PAYFINPLAN INNER JOIN BUDGET_MASTER.CLASSIFY CLASSIFY ON PAYFINPLAN.CODE8 = CLASSIFY.CODE AND PAYFINPLAN. "YEAR" = CLASSIFY. "YEAR" WHERE (PAYFINPLAN. "YEAR" = ' 2017 ') AND (CLASSIFY.TREE = ' 8 ')
Thought to make, something like the virtual table with depositing of the data from the first request, and then to fulfill a sheaf with the table of names, but something and did not achieve working result.