如何在不使用Distinct的情况下删除SQL查询中的重复项?

问题描述:

下面的查询结果中有重复项.我的问题是如何在不使用distinct的情况下摆脱subTaskName重复项?

There are duplicates in the results of the query below. My question is how to get rid of subTaskName duplicates without using distinct?

SELECT  tasks.priority, (SELECT tasks.name FROM tasks WHERE tasks.taskid ='11377') AS taskName,
        tasks.name AS subTaskName,u.name,tasks.deadline,tasks.created,a.duration AS durata,tasks.parentID,tasks.userid ,tasks.finished,
        tasks.estimated,tasks.taskid,tasks.section,tasks.tags
        FROM tasks 
        INNER JOIN users u 
        ON tasks.assignerid = u.userid
        INNER JOIN activities a 
        ON tasks.parentID = a.taskid
        WHERE tasks.parentID='11377' 
        ORDER BY tasks.taskid
        DESC

使用此链接查看图片

where子句之后:GROUP BY tasks.name

After where clause include: GROUP BY tasks.name