parser

Написать ответ на текущее сообщение

 

 
   команды управления поиском

Ответ

no name 02.02.2009 11:58

проблемное поле выделено жирным
SELECT
	KatORG.NAME as orgname,
	KatSopr.NSOPR as nsopr,
	SpSopr.DSOPR as dt, 
	KatMC.Name as mcname,
	katotped.name as edizm,
	CONVERT(Spsopr.KOLFACT,SQL_double) as kolfact,
	katMC.VOLUME*spsopr.KOLFACT as volume,
	KatMC.BARKOD as barkod, 
	convert(spsopr.price,SQL_DOUBLE) as price,
	kolfact*price as stoimvnde,
	katstate.name as strana,
	katsopr.NAME as descr,
	spsopr.nrec as nrec
FROM
	Spsopr, Katsopr, KatORG, KatMC, katotped, katstate
WHERE
(
   Spsopr.CSOPR = KatSopr.NREC
    and
   Spsopr.CMCUSL = KatMC.NREC
    and
   KatSopr.CORG = KatORG.NREC
    and 
   spsopr.cotped = katotped.nrec
    and
   katorg.cstate = katstate.nrec
)
AND
(
   SpSopr.VIDSOPR = $iem
    and
   SpSopr.DSOPR >= '$form:dt_from' and SpSopr.DSOPR <= '$form:dt_to'
    and
   SpSopr.PRMC = 1
    and
   KatSopr.CORG <> 281474976710660
    and
   $country_filter
)
ORDER BY
	dt, katorg.name,nsopr, mcname
}]}