buss (busSrno, BusName). busSrno is PK. 1 bus1 2 bus2 3 bus3 line (lineNo, Frombus, Tobus) : here Frombus and Tobus columns will contain values of busSrno from buss table. lineNo is PK. 1 1 2 2 1 3 3 2 3 4 3 2
select concat( (select BusName as 'frombusName' from buss where busSrno in (select frombus from line)), '-', (select BusName as 'tobusName' from buss where busSrno in (select tobus from line)) ) as LineName;
Sub-query returns more than 1 row.
LineName bus1-bus2 bus1-bus3 bus2-bus3 bus3-bus2
frombus
line
busSrno
buss
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)