mysqli - Compare comma-separated string in MySQL column where column is also comma separated -


Compare the comma-separated strings in the MySQL column, where the column is also separated by commas

Example For:

  Name of ID CATID 1 ABC 4,5,2 2 BCD 5 3 FEG 9, 79 SELECT * Where CATED IN (2,5,6)  < / Pre> 

Here 2,5,6 I have to compare with the cated value to get the results. Any help to get the right exit, I used FIND_IN_SET, but it could not work for my case

According to your problem, using the operator like the choice from INK

  SELECT * instead of 'Selection' from Undertake like '%, 5,%' or 'CONCAT' Like '%, 6,%' like '', ',', '', ',', '', ',', '', 'or' CONCAT '(', ', cat,', ') ', Cat,', '' ''   

or you can use REGEXP

  SELECT * testchintan where the catered rig Where place (cated, ',', '|') is the testchintan from AEX '[495]' '  

OR

  SELECT * [9,7] '   

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -