Mysql find max column value based on array list -
hi have following mysql table
id item_name user_id wishlist item_url id_category cost 30 kiko 76 1 70 10 31 test1 76 1 70 20 32 test12 76 1 68,67 30
how can max cost item. means need max cost item based on category id.
my attempt of using select max(cost),id item_tbl (find_in_set('68','70,68,67'))
not return correct output thought gives max(cost)
of 30.
this might give desired output.
select id_category, max(cost) item_tbl group id_category;
Comments
Post a Comment