这个想法是用户可以选择一行一路并获得时间表。有人可以用mysql查询帮助我吗?
我的数据库中有3个表
示例:
Table Roads
Id | Linename
1 | StackoverflowLine
表格行
HoursLineId | HoursRoadId | hours
1 | 2 | 8:35:13
表时间
def hello1(a,g):
a(g)
a(g)
def hello2(ar):
print(ar)
print(ar)
hello1(hello2, "hello")
print("")
def do_four(a,g):
hello1(a,g)
hello1(a,g)
do_four(hello2, "hello1")
print("")
def do_eight(sf):
print(sf)
print(sf)
do_four(do_eight, "hello2")
def do_eight1(a,g):
do_four(a,g)
do_four(a,g)
do_eight1(do_eight, "hello3")
def do_sixteen(add):
print(add)
print(add)
do_eight1(do_sixteen, "hello4")
def do_sixteen1(a,g):
do_eight1(a,g)
do_eight1(a,g)
do_sixteen1(do_sixteen, "hello5")
答案 0 :(得分:0)
您必须使用内部联接才能基于外键加入3个表。
SELECT * FROM hours
INNER JOIN Roads ON Roads.Id=hours.HoursRoadId
INNER JOIN Lines ON hours.HoursLineId=Lines.Id
where Roads.Id='Your ID' AND Lines.Id='Your Id';
按照线路ID 和道路标识进行过滤后,这将获得时间表。