Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I have 3 tables
Table 1 : Article, Désignation
Table 2 : Article, Quantité, Autres
Table 3 : Article, Libellé, Divers
I want to reduce Table 1 with only records where exist in Table 2 or Table 3. Try to use keep left but works only with 2 tables.
Thanks
Hello,
I'd load first Table2 and Table3, then use Exists() or ApplyMap() to reduce data loaded from Table1:
Table2: LOAD Article, Quantité, AutresFROM Table2; Table3: LOAD Article, Libellé, DiversFROM Table3; ArticleReduceMap: // used for the applymap solution, not needed in the exists solutionMAPPING LOAD Article, 1 AS LoadRESIDENT Table2;CONCATENATE LOAD Article, 1 AS LoadRESIDENT Table3; Table1:LOAD Article, DésignationFROM Table1WHERE ApplyMap('ArticleReduceMap', Article) = 1;// WHERE EXISTS(Article); // will work too without the mapping table
Hope it helps
Thanks for your quick response.
So if i want to do this with exists fonction i only need this code. Exact ?
Table2:
LOAD Article,
Quantité,
Autres
FROM Table2;
Table3:
LOAD Article,
Libellé,
Divers
FROM Table3;
Table1:
LOAD Article,
Désignation
FROM Table1 WHERE EXISTS(Article);
That's correct.
This maybe faster (I haven't tested so far) if both Table2 and Table3 are large tables, since the Resident load proposed for the mapping table may take long to load. But as EXISTS() also discriminates results, if performance is an issue, you should try both.
Regards.
Thank you very mutch. I will try this.