阅读背景:

如何根据多个MAX条件选择每个组的单个记录?

来源:互联网 

I've got 2 tables:

我有两张桌子:

workouts
id,    name, difficulty_level, rounds_count, some other columns...
 1,     'a',                1,            1
 2,     'a',                1,            5
 3,     'a',                2,            1
 4,     'a',                2,            5

 5,     'b',                1,            1 
 6,     'b',                1,            5
 7,     'b',                2,            1
 8,     'b',                2,            5

trainings
id, user_id,       workout_id,   created_at, some other columns...
 1,       1,                6,   2014-07-06
 2,       1,                1,   2014-07-07
 3,       1,                4,   2014-07-08
 4,       1,                7,   2014-07-09
workouts
id,    



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: