I wasn't sure how to word this but this is what I am looking for:
Currently my table looks like this:
CodePudding user response:
On MySQL 8 , we can use RANK()
:
WITH cte AS (
SELECT *, RANK() OVER (PARTITION BY common_id ORDER BY id) rnk
FROM yourTable
)
SELECT id, string, common_id
FROM cte
WHERE rnk = 1;