Goran Bibic

Goran Bibic

  • 482
  • 2.9k
  • 197.8k

Sum if is value varchar

May 26 2018 6:19 AM
Sum if is value varchar...sum, iff is null to be 0
 
 
  1. select dobavljac as 'Dobavljac', SUM(isnull(cast(REPLACE(CONVERT(varchar,CONVERT(float,iznos_sa_pdv),1)), '#,0.00',''),0) AS UKUPNO)  
  2. from (select dobavljac, iznos_sa_pdv from ulazni_racun_roba_lista union all select poslovni_partner, iznos_sa_pdv from mp_ulazni_racun_ostalo_lista) as alltables   
  3. group by dobavljac 
 
 error is
 
Msg 174, Level 15, State 1, Line 1
The replace function requires 3 argument(s).
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'as'.
 
 

Answers (2)