Problem using Min(field)
- by Todd
have these two queries:
SELECT classroomid AS crid, startdate AS msd
FROM unitTemplates where classroomid = 6
GROUP BY classroomid
and:
SELECT classroomid AS crid, Min(startdate) AS msd
FROM unitTemplates where classroomid = 6
GROUP BY classroomid
The second query uses the minimum function. There is only one record in my table with a classroomid of 6. The first query returns msd = 20100505, the second query returns msd = 0 (instead of the expected 20100505). If I change the "Min" to "Max" it returns the highest (and only) startdate (20100505).
Why doesn't MySQL like the Min function I'm using?