I have the following SQL statement:

SELECT track_id, MIN(time), tempo
FROM tempo_map
GROUP BY track_id;

And a table tempo_map:

1|0|130
2|0|124
3|0|154
3|20|82
5|0|120
5|10|164

The idea is that the SELECT should find the tempo belonging to the lowest time
for each track_id. However, when executing the statement it comes back with:

5|0|164
3|0|154
4|0|154
2|0|124
1|0|130

I would have thought, and wanted, the first line to come out as 5|0|120 since
MIN(time) for track_id 5 is 0 and its corresponding tempo is 120. Why does it
mix the rows putting 164 in which belongs to the row with time=10? Note that I
get the expected result for track_id=3.

Is there no guarantee that an attribute selected along with a MIN will
correspond to the same row as the MIN?

Thanks,
Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to