I have a table called "obs" with the following:
observation INT AUTO_INCREMENT,
morph VARCHAR,
date DATE,
plot VARCHAR,
number INT,
comment TEXT,
week VARCHAR
observation is the primary key, and morph is a foreign key.
How do I make a query such that I get all the latest observation
'dates' of every distinct 'morph'?
Search this group for "strawberry query"
Also read
http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group-row.html
(you want the LEFT JOIN example)
why not do:
SELECT morph, max(date) date FROM obs GROUP BY morph
Could be done, but not if you want the field 'observation' in there too.
So either solution could be valid, depending on what the OP really needs.
--
Rik Wasmus