Select a record with the latest date

From SQLZoo
Jump to navigation Jump to search

Select a record with the latest date.

schema:gisq

There may be several records with the same date.

There are two steps...
(a) Find the latest date
(b) Select records with that date
With a nested select we can do both of these in one go.

SELECT * FROM totp where wk=
  (SELECT MAX(wk) FROM totp)
DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects