query sql for a FIRST AND LAST record date code example
Example: select first and last row sql
select
(select <some_column> from <some_table>
order by <some_field> limit 1) as oldest,
(select <some_column> from <some_table>
order by <some_field> desc limit 1) as newest
;