I'm trying to select distinct from different tables in laravel. In oracle I have implemented successfully the query and works. Now I'm trying to "translate" it into laravel. How can I do that?
In oraclesql the query is the following. TEMP table exists as well as all other tables used in this query. Is it possible to do this with DB::raw? Could you give me your advice please?
INSERT INTO TEMP (OBJECT_TYPE, OBLECT_ID) SELECT DISTINCT HRP1001_CG.OBJECT_TYPE, HRP1001_CG.OBJECT_ID FROM HRP1001_SC, HRP1001_CG, CONFIG WHERE (HRP1001_SC.OBJECT_TYPE = 'CG') AND (HRP1001_SC.REL_OBJ_TYPE = 'SC') AND (HRP1001_SC.REL_OBJ_ID = CONFIG.SC) AND ((HRP1001_SC.ST_DATE < CONFIG.DES_DATE) AND (HRP1001_SC.END_DATE > CONFIG.DES_DATE)) AND (HRP1001_CG.REL_OBJ_ID = HRP1001_SC.OBJECT_ID) AND ((HRP1001_CG.OBJECT_TYPE ='CG') OR (HRP1001_CG.OBJECT_TYPE ='SM')) ORDER BY HRP1001_CG.OBJECT_ID;