I am developing a project which helps a person to find out the bus route with bus no and details of switches between the buses. I am able to find the route till single switch but more then that I am not able to do so. please help.
Now my quest is how to GO "SARAI" from "Cantt"? Using the same table.
Column Bus_Stop_Up is having the bus route in upwards and Bus_Stop_Down is having the bus route Downwards.
Result should be like "Cantt(781)->Dwarka(764)->Nehruplace(456)->SARAI"
Details of table are mention below:
CREATE TABLE [dbo].[bustable]
(
[Sr] [int] NULL
[bus_no] [varchar](50) NULL,
[Bus_Stop_Up] [varchar](50) NULL,
[Bus_Stop_Up_Id] [int] NULL,
[Bus_Stop_Down] [varchar](50) NULL,
[Bus_Stop_Down_Id] [int] NULL,
)
Table data
||Sr | bus_no | Bus_Stop_Up | Bus_Stop_Down | Bus_Stop_Up_Id | Bus_Stop_Down_Id||
-------------------------------------------------------------------------------------------------------------
||1 | 781 | DWARKA | NEW DELHI | 1 | 1 ||
||2 | 781 | Airport | Cantt | 2 | 2 ||
||3 | 781 | Cantt | Airport | 3 | 3 ||
||4 | 781 | NEW DELHI | DWARKA | 4 | 4 ||
||5 | 764 | DWARKA | NEHRU PLACE | 1 | 1 ||
||6 | 764 | NEHRUPLACE | DWARKA | 2 | 2 ||
||7 | 456 | NEHRU PLACE | SARAI | 1 | 1 ||
||8 | 456 | SARAI | NEHRU PLACE | 2 | 2 ||