Mysql group by question
I have a mysql database table with contains prices from different shops. Structure of the table is: pw_id | int product_id | int webshop_id | int price | float updated_at |timestamp
Now I want to do a query to get the webshops and there latest price for a product. I thought I could use group by but that doesn't work because I have the sql_mode = only_full_group_by active.
Statement I try to run is: SELECT webshop_id, price, updated_at FROM prices WHERE product_id = 3 GROUP BY webshop_id ORDER BY updated_at
Now I get the error that statement 2 (and 3) are not in the group by I don't want them there, it should only group on the webshop_id. It there a other way to get a list of webshops and there latest prices ?
Please or to participate in this conversation.