, 19 2014 . 19:39
+
!
:
| 01.01.2014 | sell | | | 01.01.2014 | sell | | | 01.01.2014 | sell | | | 01.01.2014 | sell | | | 01.01.2014 | sell | | | .... | | 02.08.2014 | sell | | | 02.08.2014 | sell | | | 02.08.2014 | sell | | | 02.08.2014 | sell | | | 02.08.2014 | sell | | | .... | | 05.08.2014 | sell | | | 05.08.2014 | sell | | | 05.08.2014 | sell | | | 05.08.2014 | sell | | | 05.08.2014 | sell | |
|
- , :
| DT | TYPE | MNG_NAME | COUNT_DT | | 01.01.2014 | sell | | 50 | ' COUNT(DT) LEFT(DT;2) = "01" | | 01.03.2014 | sell | | 50 | | 01.04.2014 | sell | | 50 | | 01.05.2014 | sell | | 80 | | 01.06.2014 | sell | | 10 | | 01.07.2014 | sell | | 60 | | 02.08.2014 | sell | | 50 | '(DT) LEFT(DT;2) <> "01" | | 05.08.2014 | sell | | -20 | ' COUNT (1) |
|
(1):
(SELECT COUNT(Q1.DT) FROM Q1 WHERE Q1.DT = (SELECT MAX(Q2.DT) FROM Q2)) -
(SELECT COUNT(Q1.DT) FROM Q1 WHERE Q1.DT = (SELECT MAX(Q2.DT) FROM Q2 WHERE Q2.DT < (SELECT MAX(Q3.DT) FROM Q3)))
http://www.sql.ru/forum/1127547/zapros-s-odnovremenno-staticheskim-i-peremennymi-znacheniyami