Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 492 Bytes

first_record_group.md

File metadata and controls

15 lines (10 loc) · 492 Bytes

Select first record from group

SELECT id, name FROM table WHERE id IN ( SELECT min(id) FROM table GROUP BY name )
  • SELECT id, name - columns to select
  • table - table name to select from (definition)
  • WHERE id IN - select only certain ids, defined by subquery
  • SELECT min(id) FROM table GROUP BY name - subqyery will return first (minimum) ids for each unique name value

group: record_order

link_youtube: https://youtu.be/vcjlosmdixA