我的数据库中有以下表格。我正在尝试从所有三个表中检索数据。
表格结构:
User_New
User_ID
Name
Password
Email
User_Group_New
User_ID
Group_ID
Group_New
Group_ID
Group_Name
问题:我收到了重复记录。
查询:
SELECT *
FROM `User_New`
INNER JOIN User_Group_New ON User_Group_New.User_ID = User_New.User_ID
INNER JOIN Group_New ON Group_New.Group_ID = User_Group_New.Group_ID
LIMIT 0, 30
答案 0 :(得分:0)
SELECT DISTINCT *
FROM `User_New`
INNER JOIN User_Group_New ON User_Group_New.User_ID = User_New.User_ID
INNER JOIN Group_New ON Group_New.Group_ID = User_Group_New.Group_ID
LIMIT 0, 30
可以解决你的问题。