多表查询问题!!!
Rank表里面有3个字段RankName,UpgradeCountMin,UpgradeCountMax
User_Profile表里面有个字段TotalPosts
User_Info里面有个字段是UserName(有值为AAA)
要查出RankName,并且UpgradeCountMin <TotalPosts <UpgradeCountMax,还要UserName为AAA
最后个要求不知道行得通不?必须以select RankName from Rank...开头
------解决方案--------------------select RankName from Rank a, User_Profile b, User_Info c
where (a.UpgradeCountMin < b.TotalPosts and b.TotalPosts <a.UpgradeCountMax)
and c.UserName = 'AAA '
------解决方案--------------------rank表和 USER_PROFILE的关系不明确
------解决方案--------------------select RankName from Rank where rank_name in (select RankName from Rank a, User_Profile b, User_Info c
where (a.UpgradeCountMin < b.TotalPosts and b.TotalPosts <a.UpgradeCountMax)
and c.UserName = 'AAA '
)
纯属抄袭,呵呵,同样的疑问,为什么要写成这样呢?