Цитата(Akina @ 16.8.2011, 21:03 ) | Есть агрегатка - обязан быть и групбай
|
с чего бы?
Код | select count(*) from some_table
|
куда тут груп бай засунуть?
rodnover, где гарантия что id будет соответствовать max initiative? http://dev.mysql.com/doc/refman/5.5/en/group-by-hidden-columns.html
Цитата | The server is free to choose any value from each group, so unless they are the same, the values chosen are indeterminate.
|
supervladislav,
Код | select id from users where id in(6,1) and initiative = (select MAX(initiative) from users where id in(6,1)) -- order by ?? limit 1
|
Без подзапроса - stff http://forum.vingrad.ru/act-Search/CODE/show/searchid-27476eb561eb58f599ffa025aa096f02/search_in-posts/result_type/topics/flag/search/highlite/%2522%25D0%25B1%25D0%25B0%25D0%25B1%25D1%2583%25D1%2588%25D0%25BA%25D0%25B8%25D0%25BD+%25D0%25BC%25D0%25B5%25D1%2582%25D0%25BE%25D0%25B4%2522/index.html |