Let's assume, that I have the following table: (id, subject_id) and in this table I have following records:
id: 1, subject_id: 1 id: 2, subject_id: 1 id: 3, subject_id: 2 id: 4, subject_id: 1 id: 5, subject_id: 2
How can I get only first row where subject_id = 1 and first row where subject_id = 2:
id: 1, subject_id: 1 id: 3, subject_id: 2