如果我有这样的使用结果在不同的表
table_1
Field 1: victories
Field 2: name
table_2
Field 1: name
Field 2: birthday
三个不同的表现在,我想要得到的人的生日最胜利。
所以我会做这样的事情(伪代码):
select victories from table_1 and sum_it_all
get name and pass name to table_2
select birthday from table_2 where name
好吧,这是很丑陋的伪代码,但我希望你明白了吧。
使用Andomar的解决方案工作正常。 现在我试图巢另一个表中它,这样虽然:
select address
from table_3
where birthday =
(
select birthday
from table_2
where name =
(
select name
from table_1
group by
name
order by
sum(victories) desc
limit 1
)
)
我得到一个正确的答案,但因为某些原因也得到了null
回来。我将如何输出胜利的总和?
你的问题是这个? 这看起来像你有你的问题的答案.. –