Link to home
Create AccountLog in
Avatar of websss
websssFlag for Kenya

asked on

return calculated difference sql

Hi
I have the following query
select min(odometer) as odometer_min, max(odometer) as odometer_max
From dbo.MyTable
Where gpsDateTime >= '2018-01-01' and gpsDateTime < '2018-01-18' and eventID = 1

Open in new window


this returns 2 values

What i actually need to do is return the difference between the min and max

What would the sql be for this
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account