我必须执行以下查询:
select users.Name, users.ProfilePictureUrl, commons.Name, provinces.Name, GetAge(users.Birthday) as Age, users.LastOnline,
search_scores.SocialAccountPresent, search_scores.UnansweredMessages, search_scores.WeightedRecentMessages
from users
inner join search_scores on users.ID = search_scores.UserID
inner join commons on commons.ID = users.CommonID
inner join provinces on provinces.ID = commons.ProvinceID
where (ProfileValid = 1)
order by SocialAccountPresent desc, UnansweredMessages asc, WeightedRecentMessages asc
但是,结果集为空,但如果我包含order子句,则仅。当省略order-by时,所有结果都正确显示...结果集中有两行,对于所有这些行,SocialAccountPresent = 1,UnansweredMessages = 0和WeightedRecentMessages = 0.。
我很困惑......建议?