Query: SELECT distinct l.name,l.id FROM `station` s join line_station ls on s.id=ls.station_id join line l on l.id=ls.line_id WHERE s.name=''