SELECT
    f.id AS id,
    f.name AS name,
    f.place_id AS place_id,
    f.category AS category,
    f.images AS images,
    f.thumbImage AS thumbImage,
    ST_AsGeoJSON(f.loc) AS location,
    ST_Distance(f.loc, ST_SetSRID(ST_Point(-97.7286718, 30.3033267),4326)::geography) / 1609 AS distance,
    q.quantity AS quantity,
    q.date AS lastUpdated
FROM food_items f
LEFT OUTER JOIN latest_quantities q
ON f.id = q.food_item_id
WHERE ST_DWithin(loc, ST_SetSRID(ST_Point(-97.7286718, 30.3033267),4326)::geography, 20 * 1609)
AND f.category IN ('desserts', 'beverages', 'entrees', 'other')
ORDER BY distance ASC;
