#Näherste / fernste Stationen
SELECT
id,
length,
s.name,
g.name
FROM connections
LEFT JOIN stationen AS s ON start = s.ref
LEFT JOIN stationen AS g ON goal = g.ref
WHERE start != goal
ORDER BY length ASC;
# Suche nach Namen
SELECT *
FROM stationen
WHERE name LIKE "%Spitt%";
#gpsprune
name,
group_concat(id, ".gpx" SEPARATOR " ")
LEFT JOIN stationen ON (start = ref OR goal = ref)
WHERE ref = 906
ORDER BY length;
#(vermutlich) abgelegenste Stationen
FROM (SELECT
ref
ORDER BY length ASC) AS x
GROUP BY ref
ORDER BY length DESC