Skip to content

Move computation into database layer #58

Description

@travipross

sample query to calculate basic fuel economy from fillup table:

SELECT 
  *, 
  odometer_km - LAG(odometer_km, 1, 0) OVER (ORDER BY timestamp) as odo_diff, 
  ROUND((fuel_amt_l / ( odometer_km - LAG(odometer_km,1,0) OVER (ORDER BY timestamp)) * 100)::numeric, 1) as lp100k 
FROM fillup 
WHERE vehicle_id = 1 
ORDER BY timestamp;

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions