Cześć
Potrzebuje zrobić zapytanie, które zwróci mi pola z obiektu ObjectPlus, a także jeżeli jest asocjacja to z obiektu FilePlus, który jest danego typu.
Jak robię takie zapytanko:
Select op.id as id, op.name as name, fp as fileplus from ObjectPlus op LEFT JOIN FilePlus fp on op.id = fp.object where fp.type in (3,5,6) or fp is null;
To jest super, ponieważ jak nie ma asocjacji lub też FilePlus nie jest danego typu to zwraca fileplus jako null. Niestety obiekt FilePlus ma również inne asocjacje i przy pobieraniu dużej ilości elementów to trwa bardzo długo.
Próbuje wyciągnąć poszczególne dane z FilePlus, lecz tu pojawia się duży problem - nie są zwracane obiekty typu ObjectPlus, gdzie nie ma asocjacji lub gdzie typ jest inny niż w zapytaniu.
Możecie podpowiedzieć co z tym fantem można zrobić?
Select op.id as id, op.name as name, fp.name as filename, fp.type as type from ObjectPlus op LEFT JOIN FilePlus fp on op.id = fp.object where fp.type in (3,5,6) or fp is null;