Select x.usertype,count(x.favorityid) from
(
Select
Case When A.Usertype=B.Loginid Then B.Nickname
When A.Usertype=C.Loginid Then C.Nickname
When A.Usertype=D.Loginid Then D.Nickname
End As usertype,a.favorityid
(
Select
Case When A.Usertype=B.Loginid Then B.Nickname
When A.Usertype=C.Loginid Then C.Nickname
When A.Usertype=D.Loginid Then D.Nickname
End As usertype,a.favorityid
From O_Classfavorityinfo A,E_Logininfo B,e_parentlogininfo C,E_Teacherlogininfo D
Where A.Usertype=B.Loginid Or A.Usertype=C.Loginid Or A.Usertype=D.Loginid
) x
group by x.usertype
Where A.Usertype=B.Loginid Or A.Usertype=C.Loginid Or A.Usertype=D.Loginid
) x
group by x.usertype
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-668497/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-668497/