php - Getting two or more images ids from the same column -


i got mysql table 1 or more comma separated numbers in it. numbers refer id's in mysql table, witch includes name of image.

i want select row field "images" contains "1,43" , display 2 images id 1 , 43 2nd table.

do have have 2 numbers in differents fields? i'd prefer keep them in same one.

use find_in_set. assuming have table below,

table1

+++++++++++ images +++++++++++ 1,43 

table2

+++++++++++++++++ imageid  image +++++++++++++++++ 1        .... 43       .... 

sample query:

select  b.*    table1         inner join table2 b             on find_in_set(b.imageid, a.images) > 0 

if have time modify structure of table. please do. query above perform slow if doing on large databases.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -