Hacker News new | past | comments | ask | show | jobs | submit login

That's basically short-hand for

  SELECT manifest, versionId, max(checkinTime)
  FROM version
  GROUP BY manifest, versionId
  ORDER BY 3 DESC LIMIT 1;
or

  WITH m AS (SELECT max(checkinTime) AS checkinTime FROM version)
  SELECT v.manifest, v.versionId, v.checkinTime
  FROM version v
  JOIN m m USING (checkinTime)
  LIMIT 1;
It's a bit of a footgun though because there is some randomness here if multiple rows have the same max checkinTime, so I try not to use this SQLite3-ism. You want to also do something to deterministically pick a "best" row, but for that you need to do something like the above.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: