SQLite Forum

Select distinct from most recent record
Hi Ryan,

You're right, I was a little sloppy with my post. Thank you for help in educating me.

> I'm thinking that you mean you want the "most recent" (as in highest number value in col2) item for every distinct value in col1, right?

Yes! Exactly correct.

Why doesn't this work?

sqlite> select col1, max(col2) from t group by col1;

Using my sample data, BBB had a max of 154000 but here, it says 98000 is the highest.

Even asking for highest `max(col2)` ignores 154000.

sqlite> select max(col2) from t;