Re: [SQL ] 高考SQL題目

看板Database作者 (4545454554)時間14年前 (2011/08/15 16:06), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/7 (看更多)
※ 引述《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
文章代碼(AID): #1EIDEXUk (Database)
討論串 (同標題文章)
文章代碼(AID): #1EIDEXUk (Database)