Hi
This is the original data:
37 2003-12-13 00:56:43.000 -199.0
37 2003-12-13 00:56:43.000 -156.0
38 2003-12-13 00:56:43.000 -9.0
38 2003-12-13 00:56:43.000 3.0
37 2003-12-13 00:56:44.000 117.0
What i would like to see some how is:
37 2003-12-13 00:56:43.000 -199.0
38 2003-12-13 00:56:43.000 -9.0
37 2003-12-13 00:56:44.000 117.0
i.e the maximum absolute value.
I have written this so far:
select xdsensorid, xddatetime, max(abs(xdvalue)), xdlongitude, xdlatitude
from ((vmi_vehicles
inner join ext_sensors on vunitid = sunitid)
inner join his_externaldata on xdsensorid = ssensorid)
where vdescription = 'Shell 153456'
and (schannelnumber = 54 or schannelnumber = 55)
group by xdSensorID, xdDateTime, xdlongitude, xdlatitude
order by xddatetime, xdsensorid
and get this result:
37 2003-12-13 00:56:43.000 199.0
38 2003-12-13 00:56:43.000 9.0
37 2003-12-13 00:56:44.000 117.0
is there any way to write this query and if the value happens to be a negative to keep the negative sign.
Thanks for your help,
B
This is the original data:
37 2003-12-13 00:56:43.000 -199.0
37 2003-12-13 00:56:43.000 -156.0
38 2003-12-13 00:56:43.000 -9.0
38 2003-12-13 00:56:43.000 3.0
37 2003-12-13 00:56:44.000 117.0
What i would like to see some how is:
37 2003-12-13 00:56:43.000 -199.0
38 2003-12-13 00:56:43.000 -9.0
37 2003-12-13 00:56:44.000 117.0
i.e the maximum absolute value.
I have written this so far:
select xdsensorid, xddatetime, max(abs(xdvalue)), xdlongitude, xdlatitude
from ((vmi_vehicles
inner join ext_sensors on vunitid = sunitid)
inner join his_externaldata on xdsensorid = ssensorid)
where vdescription = 'Shell 153456'
and (schannelnumber = 54 or schannelnumber = 55)
group by xdSensorID, xdDateTime, xdlongitude, xdlatitude
order by xddatetime, xdsensorid
and get this result:
37 2003-12-13 00:56:43.000 199.0
38 2003-12-13 00:56:43.000 9.0
37 2003-12-13 00:56:44.000 117.0
is there any way to write this query and if the value happens to be a negative to keep the negative sign.
Thanks for your help,
B