со структурой отправляет 3 запроса: 1) select SC1274.DESCR, SC1274.PARENTID,RG5302.SP5304,RG5302.SP5305,0,0,RG5302.SP5305, 0,RG5302.SP5303,RG5302.SP5305 from RG5302(NOLOCK) left outer join SC1274(NOLOCK) on RG5302.SP5304=SC1274.ID where PERIOD = ''20061201'' 2) select SC1274.DESCR, SC1274.PARENTID,RA5302.SP5304,0,case when DEBKRED = 0 then RA5302.SP5305 else 0 end,case when DEBKRED = 1 then RA5302.SP5305 else 0 end,0, 0,RA5302.SP5303,RA5302.SP5305 from _1SJOURN(NOLOCK) left outer join RA5302(NOLOCK) on _1SJOURN.IDDOC=RA5302.IDDOC left outer join SC1274(NOLOCK) on RA5302.SP5304=SC1274.ID where _1SJOURN.RF5302 = 1 and _1SJOURN.DATE_TIME_IDDOC >= ''20070101 0 0 '' and _1SJOURN.DATE_TIME_IDDOC < ''20070607 1 0 '' and _1SJOURN.CLOSED&1 = 1 3)select SC1274.DESCR, SC1274.PARENTID,RG5302.SP5304,RG5302.SP5305,0,0,RG5302.SP5305, 0,RG5302.SP5303,RG5302.SP5305 from RG5302(NOLOCK) left outer join SC1274(NOLOCK) on RG5302.SP5304=SC1274.ID where PERIOD = ''20070601'' Вариант без структуры 1) select SC1274.DESCR, SC1274.PARENTID,RG5302.SP5304,RG5302.SP5305,0,0,RG5302.SP5305, 0,RG5302.SP5303,RG5302.SP5305 from RG5302(NOLOCK) left outer join SC1274(NOLOCK) on RG5302.SP5304=SC1274.ID where PERIOD = ''20061201'' and (((RG5302.SP5303 ='' 1 '')) and ((RG5302.SP5304 ='' 1 ''))) 2)select SC1274.DESCR, SC1274.PARENTID,RA5302.SP5304,0,case when DEBKRED = 0 then RA5302.SP5305 else 0 end,case when DEBKRED = 1 then RA5302.SP5305 else 0 end,0, 0,RA5302.SP5303,RA5302.SP5305 from _1SJOURN(NOLOCK) left outer join RA5302(NOLOCK) on _1SJOURN.IDDOC=RA5302.IDDOC left outer join SC1274(NOLOCK) on RA5302.SP5304=SC1274.ID where _1SJOURN.RF5302 = 1 and _1SJOURN.DATE_TIME_IDDOC >= ''20070101 0 0 '' and _1SJOURN.DATE_TIME_IDDOC < ''20070607 1 0 '' and _1SJOURN.CLOSED&1 = 1 and (((RA5302.SP5303 ='' 1 '')) and ((RA5302.SP5304 ='' 1 ''))) 3)select SC1274.DESCR, SC1274.PARENTID,RG5302.SP5304,RG5302.SP5305,0,0,RG5302.SP5305, 0,RG5302.SP5303,RG5302.SP5305 from RG5302(NOLOCK) left outer join SC1274(NOLOCK) on RG5302.SP5304=SC1274.ID where PERIOD = ''20070601'' and (((RG5302.SP5303 ='' 1 '')) and ((RG5302.SP5304 ='' 1 '')))
|