0

我有一张桌子。我想将这个表加入到自身中。即它将是从两个相同的表创建的表。问题是表(QueryBuilder 中的 TableAdapert)有重复的行。我知道在 SQL 中我可以使用运算符“Distinct”。但是,当我尝试在 QueryBuilder 中编写“dictinct”时,我总是会遇到错误。

SELECT     STUDENT.ID, STUDENT.NAME, STUDENT.SURNAME, STUDENT.IDGROUP, 
STUDENT_1.ID AS Expr1, STUDENT_1.NAME AS Expr2, 
STUDENT_1.SURNAME AS Expr3
FROM STUDENT INNER JOIN
                  STUDENT AS STUDENT_1 ON STUDENT.IDGROUP = STUDENT_1.ID

哪里可以写“不同”?

4

1 回答 1

1

通常“Distict”在 SELECT 之后。

像这样

SELECT DISTINCT STUDENT.ID, STUDENT.NAME, STUDENT.SURNAME, STUDENT.IDGROUP, STUDENT_1.ID AS Expr1, STUDENT_1.NAME AS Expr2, STUDENT_1.SURNAME AS Expr3 从 STUDENT INNER JOIN STUDENT AS STUDENT_1 ON STUDENT.IDGROUP = STUDENT_1.ID

于 2013-10-24T12:50:20.403 回答