I'm wondering if the SQL gurus here can give me some direction.  I have a
very simple stats table:

CREATE TABLE StatData
(
StatID INTEGER NOT NULL,
Value REAL NOT NULL,
Date INTEGER NOT NULL
);

I'd like to pull out the most recent date and associated value for each
StatID.

I initially thought of:

SELECT StatID, max(Date), max(Value) FROM StatData GROUP BY StatID

That would give me the most recent Date, but not the Value that corresponds
with that Date.  
None of the other aggregate functions seem appropriate either.

Thanks for any ideas.

Doug


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to