SELECT EMITENT FROM EMITENT WHERE EMITENT n_emit IN SELECT SERT_VIP n_

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SELECT EMITENT.*
FROM EMITENT
WHERE EMITENT.n_emit IN (
SELECT SERT_VIP.n_emit
FROM SERT_VIP
WHERE (
SERT_VIP.[n_vip] IN (SELECT OPER.N_VIP
FROM OPER
WHERE (DT_MOD BETWEEN DateValue('2000-01-01') AND DateValue('2000-12-31'))
AND
OPER.[KOD_OPER] = (SELECT KOD_OPER.[code]
FROM KOD_OPER
WHERE KOD_OPER.[name] LIKE "*Передача ЦБ между владельцами/ДУ*")
GROUP BY OPER.N_VIP
HAVING Count(OPER.N_VIP) >= (
SELECT TOP 1 Count(OPER.N_VIP)
FROM OPER
WHERE (
(OPER.DT_MOD Between DateValue('1999-01-01') And DateValue('1999-12-31'))
AND
OPER.KOD_OPER = (SELECT KOD_OPER.[code]
FROM KOD_OPER
WHERE KOD_OPER.[name] LIKE "*Передача ЦБ между владельцами/ДУ*")
)
GROUP BY OPER.N_VIP
ORDER BY 1 DESC;
)
ORDER BY OPER.N_VIP)
)
GROUP BY SERT_VIP.n_emit
);