Re: [SQL ] 高考SQL題目
※ 引述《cutecpu (可愛中央處理器)》之銘言:
: 用你原本寫的去改的,可以應付有多個會員擁有相同最多朋友的情況:
: select mId,name,bDate
: from Member
: where mId in (
: select friend
: from FriendRelation
: group by friend
: having count(*) = (
: select max(cnt)
: from (
: select count(*) as cnt
: from FriendRelation
: group by friend
: )
: )
: )
謝謝 我用mysql下去測 出現如下錯誤
#1248 - Every derived table must have its own alias
後來我改成下面就可以了
select mId,name,bDate
From Member
Where mId in (select friend
From FriendRelation
group by friend
having count(*) = (select max(T.c)
from ( select count(*) as c
From FriendRelation
group by friend ) as T)
)
感謝各位
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.129.5.93
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 5 之 7 篇):