First value sql. Select max sql. having sql. select max from sql. having max sql.