Modeling PET 2015 Rev. 0.925 Start interrogating the PGPS well test database with SQL Explanation of your second SQL script SELECT code, max(production_day) FROM rv_pwel_result WHERE code like 'TMBG%' GROUP by code ORDER by code Will show the well name Latest date of the test Code for the field Example: Find the date of the latest well test in all strings in Tembungo table script