问题
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
Use this link to see the image
回答1:
After where clause include: GROUP BY tasks.name
来源:https://stackoverflow.com/questions/21160200/how-do-i-remove-duplicates-in-an-sql-query-without-using-distinct