- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
set @query_modern=CONCAT('
SELECT podrazdel,NSI_R.m0137.ncex as name_otdel,card.sint_schet,card.inv_num,name,date_dok,summa_modern,
nach_stoim,ostat_stoim,nach_stoim+sum(summa_modern),ostat_stoim+sum(summa_modern),summa_iznosa,
srok_iznosa , (new_let*12)+new_mes as dobal_srok,srok_iznosa+(new_let*12)+new_mes as new_srok_iznosa
FROM card LEFT JOIN modern on modern.inv_num=card.inv_num,',@amort_table,' ,NSI_R.m0137
where iznos<100 and card.inv_num=',@amort_table,'.inv_num and NSI_R.m0137.kcex=SUBSTR(card.podrazdel FROM 1 FOR 3)
GROUP BY card.inv_num
ORDER BY podrazdel');
PREPARE Modern_query from @query_modern;
EXECUTE Modern_query;
DEALLOCATE PREPARE Modern_query;
Анонимус 27.11.2014 17:35 # 0
>>NSI_R.m0137.kcex=SUBSTR(card.podrazd el FROM 1 FOR 3)
люблю такой код. его удобно править и легко понимать
betking1 27.11.2014 18:24 # 0
bot 27.11.2014 19:56 # 0
betking1 27.11.2014 20:30 # 0