Hei, I have a table LOG (Result - Picture) that shows how many meters a truck i warehouse treveled per day. I want to SUM meters per day after and before optimisation and export them as METERS BEFORE and METERS AFTER per DAY. When I excute my SQL it comes msg.: Conversation failed when converting the varchar '57.006' to data type int.
SELECT s.datreg,
SUM (CONVERT(int, SUBSTRING (s.ma_desc,7,6),2)),
SUM (CONVERT(int, SUBSTRING (s.ma_desc,39,7),2))
FROM S16T2 AS s
WHERE s.modul='MCAIDist'
GROUP BY s.datreg,s.ma_desc
ORDER BY datreg DESC
ORIGINAL SQL CODE :
SELECT S16T2.*
FROM S16T2
ORDER BY datreg DESC
The row on image shows "meters" before optimisation, and part after or. shows "meters" after optimisation.