SQL query


I have got the following tables set up in MS Access(will be using MYSQL hence strange format when I can get my hands on it.)
table Stops
stop_id int unsigned auto_increment primary key,
stop_name char(32) name of stop

table Bus
bus_id int unsigned auto_increment primary key,
bus_name, char(16) name of bus (possible int works here as well)

table Bus_Stops
bus_id int unsigned,
stop_id int unsigned,
stop_time time,
unique scheduled_stop (bus_id,stop_id,stop_time)

I have been trying to design a query that gives the following...
"Give me a list of buses that run from x lane to y lane on or after y time."

Anybody got any ideas? Obviously a bus, say the 51 runs many times each day and it may include stop x but not stop y. Whereas another service eg 11 might have both x and y and this would be the required answer.

Thank-you, it's much appreciated.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!