Answer the question
In order to leave comments, you need to log in
How to simplify the following query?
Is it possible to somehow simplify the following query?
To prevent reselection:
WHERE
main_person.inn IN -- где руководитель является учредителем
(
select
grf.inn -- founders
from mytablename t
LEFT JOIN FOUNDERS grf ON grf.record_id = t.grn_record_id
LEFT JOIN MAIN_PERSONS grmp ON grmp.record_id = t.grn_record_id
WHERE t.inn = '7714728670'
)
AND
main_person.inn IN -- где руководитель является руководителем
(
select
grmp.inn
from mytablename t
LEFT JOIN FOUNDERS grf ON grf.record_id = t.grn_record_id
LEFT JOIN MAIN_PERSONS grmp ON grmp.record_id = t.grn_record_id
WHERE t.inn = '7714728670'
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question