I have two columns in a table source and destination as below.
source delivery
s1 d1
d1 d2
d2 f1
s2 d3
d3 d4
d4 d5
d5 f2
source - s1 destination f1
source - s2 destination f2
How do I get the count of number of stops between source and destination ? For ex: source s1 -> destination f1 has 3 stops between them and source s2 -> destination f2 has 4 stops between them
I am familiar with SQL queries but never had written or encountered a problem like this. Could anyone let me know how can I write a sql query for the aforementioned problem ? Even if there is another question with the same problem, that link/question could help me a lot in understanding how to write it.