I have data per day in my database mysql. What I want to do is to select the km field in the current time in the day minus the km field in start of the day (current day time :00:00 am).
I tried this but it didnt work:
SELECT km from position where serverTime=startOfTheDay
SELECT km from position where serverTime=currentTime()
You can try this approach - it finds the difference between the smallest and largest km for each day.
select min(serverTime) as start, max(serverTime) as stop, max(km) - min(km) as km_difference from position group by date(serverTime);