I’m new to SQL, I’m using the built-in HSQL database in Base. How do I find the record that contains the latest date? I have an inventory entry where I capture items, qty, etc. and the date of the inventory action.
Hello,
To select a maximum date in a column from a table:
Select MAX("YOUR_DATE_FIELD_NAME") from "YOUR_TABLE_NAME"
To return the entire contents of that record:
Select * from "YOUR_TABLE_NAME" Where "YOUR_DATE_FIELD_NAME" = (SELECT MAX("YOUR_DATE_FIELD_NAME") from "YOUR_TABLE_NAME")
Thank you. Spot on.