Thursday, 15 May 2014

select - Mysql seletc query using in if row has komma seperated values -



select - Mysql seletc query using in if row has komma seperated values -

i'm using typo3 db. users stored in table usergroups inserted comma-separated row (usergroup = 1,5,88).

now, seek select grouping illustration checking if grouping exists in each user's dataset.

select ...... ... usergroup in (1,6,9) ...

this works well, if there 1 value in user's info (usergroup=9) if user has more 1 usergroup (usergroup=9,11,5,3) query above won't work.

i know not normalized, bu have no possibility alter this, i'm searching way utilize selection query can handle comma-separated values.

is there possibility?

use

where find_in_set(usergroup, 1) > 0 or find_in_set(usergroup, 6) > 0 or find_in_set(usergroup, 9) > 0

mysql select comma

No comments:

Post a Comment