I know this is a well known issue but i even cant fix it.

SELECT *
From (
SELECT imageID, sourceNode_id, targetNode_id, edge.description, edge.id
FROM edge
LEFT JOIN node_edge ON edge.id = node_edge.edge_id
WHERE imageID='"+partID+"' AND sourceNode_id IS NOT NULL AND targetNode_id IS NOT NULL
ORDER BY sourceNode_id
)
GROUP BY edge.id



I want to order before grouped so the expression with the lowest sourceNode "survives" the GROUP .

Please help me. Big Thx.