php - mysql | Request from empty column and FIND_IN_SET -


i have table:

id  name   position   status 1        1,2        1 2   b      1          1 3   c                 1 4   d      2          1 

where: position column text field; request here:

select `id`   `table`  `status`=1 , `position` >  '' , `position` = find_in_set( 1,  `position` )  or  `position` = find_in_set( 2,  `position` )  

this request return: 1,2,3,4. wrong need: 1,2,4 -> condition: (position > ''). problem , how change request? thanks.

you dont need check if position empty while checking numbers in field list .

you dont need check position = find_in_set.... . return value 1 in position.

you need that:

 select `id`    `table`   `status`=1  ,  find_in_set( 1,  `position` )   or   find_in_set( 2,  `position` )  

demo here


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -