1
我正在爲使用gtfs database(MySQL)的學校開發一個項目。 我寫了一些解析gtfs文件並將它們插入到MySQL數據庫(每個文件都是我的數據庫中的表格)的代碼。 我試圖寫兩個SQL查詢:從Java的GTFS文件中獲取信息的SQL查詢
給定一個
stationId
,time
和line number
- 我想通過這臺在接下來的10分鐘通過所有車次。給定一個
tripId
,directionId
和stopId
- 我想在此行的所有剩餘站(爲了繪製地圖上的站來在我的行程)。
有誰知道我該如何聲明這個SQL查詢在Java中?
我嘗試這樣做:
SELECT * FROM stops, routes, stop_times, calendar, trips
where departure_time > "08:24:00"
and departure_time < "16:40:00"
and route_short_name = "10"
and stops.stop_id = 29335
and stops.stop_id = stop_times.stop_id
and stop_times.trip_id = trips.trip_id
and calendar.service_id = trips.service_id
and calendar.sunday = 1
BTW - 我使用的是靜態的GTFS文件 – 2012-08-11 09:30:41
'SELECT * FROM站,路線,stop_times,日曆,旅行 其中DEPARTURE_TIME> 「8時24分○○秒」 和DEPARTURE_TIME < 「十六時40分00秒」 和 route_short_name = 「10」 和stops.stop_id = 29335 和stops.stop_id = stop_times.stop_id 和stop_times.trip_id = trips.trip_id 和calendar.service_id =跳閘.service_id and calendar.sunday = 1' – 2012-08-19 20:11:10