php - MySQL closest values order by count -
php - MySQL closest values order by count -
i have table:
name count name 1 1 name 2 1 name 3 1 name 4 1 name 5 2 name 6 2
if select name 2 (count = 1), how select next , previous item (name 3, name 1)? after values same.
how solve problem?
if want single query think might query loooking for.
select * table coun=(select coun table name='name1') , name!='name1'
i rename count column coun count agg. function in mysql. hope works you..
php mysql
Comments
Post a Comment