how to find first and last record from mysql table

前端 未结 5 1864
失恋的感觉
失恋的感觉 2020-12-11 00:59

I have one table I want to find first and last record that satisfy criteria of particular month.

5条回答
  •  再見小時候
    2020-12-11 01:08

    select * from table
    where id = (select id from tab1 order by col1 asc limit 1) or
    id = (select id from tab1 order by col1 desc  limit 1);
    

提交回复
热议问题