此代码返回3行,但必须返回1行。我如何使用'和'运营商在where子句?
BEGIN
SELECT auth.username,users.id,users.id_registration_type,users.name, users.surname,
users.corp_name,users.work_duration,users.photo,
like_dislike.like_count,like_dislike.dislike_count
FROM users
LEFT JOIN auth
ON users.id=auth.id
LEFT JOIN like_dislike
ON users.id=like_dislike.id
LEFT JOIN registration_type
ON registration_type.id_type = users.id_registration_type
LEFT JOIN users_region
ON users.id=users_region.id_users
LEFT JOIN users_work_area
ON users.id=users_work_area.id_users
WHERE (users_region.id_region = region)
AND (users_work_area.id_area = area_type)
AND (registration_type.id_type = reg_type)
LIMIT shows,limits;
END
答案 0 :(得分:1)
发布为社区维基。
旁注:当发布时,代表点数不计算,只是因为所有人都知道( wink )。
您可以使用DISTINCT和/或GROUP BY。
参考文献: