-2

我的数据库中有下表。我正在尝试从所有三个表中检索数据。

表结构:

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
4

1 回答 1

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

愿这能解决你的问题。

于 2013-10-15T16:02:00.033 回答