The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
mySQL intersect?
Let's say i've got a table that has a column with comma separated IDs.
Example: columname --------------- 1,2,5 4,7,8 3,6,11 Now I have a string with comma separated IDs: 2,8 Any ideas for a query to get rows that contain at least one ID from this string in column columnname? |
#2
|
||||
|
||||
This is me talking untested stuff again, but what I would do is split the string and use LIKE '$string,'. Dunno if this would fit your purpose as every 3rd number seems to be lacking their comma (and breaking the LIKE if those numbers will be searched for), else it might work.
|
#3
|
||||
|
||||
LIKE is a bad idea I think as
[sql]SELECT '23,24,25' LIKE '%2%' [/sql] does match What actually does work is [sql]SELECT * FROM table WHERE FIND_IN_SET('2', columnname) OR FIND_IN_SET('8', columnname)[/sql] but I feel that this is not a good way to do this. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|