我有这个 MySQL 表:
- 车站(ID,名称)
- station_track (id, id_station, id_track)
- 跟踪(ID,名称)
我想获取包含 A 站和 B 站的所有轨道......我只是想不通:SI 试过这样:
SELECT track.name
FROM track, station_track , station
WHERE station.id = station_track.id_station
AND track.id = station_track.id_track
AND (station.name = 'first' AND station.name = 'second')
它不起作用......我想我不能将 AND 用于相同的列值。
解决了:
SELECT proge.ime FROM postaje, postaje_proge, proge
WHERE postaje.id=postaje_proge.ID_postaje AND proge.ID=postaje_proge.ID_proge
AND postaje.ime_postaje in ("AP Mlinska","City Center")
GROUP BY proge.ime
HAVING count(proge.ime)=2
tnxx 伙计们寻求帮助!