简体   繁体   中英

How to use “Distinct” in QueryBuilder of Visual Studio 2010?

I have one table. I want to join this table to itself. Ie it will be a table which is created from the two same tables. The problem is that the table(TableAdapert in QueryBuilder) has duplicate rows. I know that in SQL I can use an operator "Distinct". However, when I try to write "dictinct" in QueryBuilder then I always catch an error.

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

Where is it possible to write "Distinct"?

Normally "Distict" is following after the SELECT.

like this

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 FROM STUDENT INNER JOIN STUDENT AS STUDENT_1 ON STUDENT.IDGROUP = STUDENT_1.ID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM