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.enter image description here

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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -