View difference between Paste ID: JdJdV5Wm and jL9kQpT5
SHOW: | | - or go back to the newest paste.
1
select  distinct astops.name, cstops.name from
2
  route a join route b on a.company=b.company and a.num = b.num
3-
              join route c on b.company=c.company and b.num = c.num
3+
              join route c on b.company=c.company and b.num = c.num and b.stop = c.stop
4
              join stops astops on a.stop = astops.id
5
              join stops bstops on b.stop = bstops.id
6
              join stops cstops on c.stop = cstops.id
7
where astops.name = 'Craiglockhart' and cstops.name = 'Sighthill'