您好。我是SQL中的菜鸟,所以如果你帮我写一个SQL请求来获取FINALSCORE字段FROM tennisset table,那将是appriciate,与tennismatch相关WHERE id = 1
感谢。
答案 0 :(得分:2)
尝试此查询:
delete from tennismatch_tennisset where TennisMatch_ID =1
delete from tennismatch where id=1
从表“tennismatch”中删除记录,首先从子表“tennismatch_tennisset”中删除记录。
尝试这样的事情:
ifelse
答案 1 :(得分:1)
您需要在表之间使用连接。在你的情况下,它必须通过 tenismatch_tenisset 完成,它是两者之间的绑定表。
select finalscore from tennismatch m
join tenismatch_tennisset ms
on m.id = ms.tennismatch_id
join tennisset s
on ms.mapofsets_id = s.id
where m.id = 1