php - count unique id separeted by commas in single row -


i have following details in mysql as

   user_id                  follow_user_id                                                        1                      2,3,3,3,3    5                      1,2,3,3,3,3    6                      1,2,3,3,3,3   

i write following code unique code follow:

select length( follow_user_id ) - length( replace( follow_user_id, ',', '' ) ) +1 no_of_follow follow user_id =1; 

but provide result :6 need unique rows: i.e:4

plz me & regards in advance

apart db design questions use in php after fetching row $result:

count(array_unique(explode(",",$result["follow_user_id"))); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -