LoginSignup
1
0

More than 5 years have passed since last update.

mysqlでgroup byを使用したときの結果が違う

Posted at

mysql version: 5.5.42

mysqlこんな値を書いたとします。


select max(price) as max_price, products.* from products group by category_id

このようにした場合、max_priceと products.*は同じrowから取得されるとは限らないので注意!

私は同じrowから取得されると勘違いしていたので、自戒とメモの意味を込めて投稿しました。

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0