0

Suppose I have two arrays. One looking like (3, 9, 10, 39), and one looking like (4, 10, 9, 48, 391, 2).

How would I (through pure MySQL) check if one of the elements in the first array is inside the other array?

Edit By checking, I mean returning true if one item of the first array is occuring in the second array.

Example:

SELECT IsElementFromFirstArrayInAnotherArray(array1, array2) AS isInArray
  • 2
    There is no "array" datatype in MySQL. How are the numbers stored in the database? In the same column, one number per row/field? All in the same field, comma-separated? – ypercubeᵀᴹ Mar 19 '13 at 15:34
  • array1 is a field with comma-separated values. array2 is a direct array that I parse into the query string with the syntax (1,2,3,4,2) etc. – Mathias Lykkegaard Lorenzen Mar 20 '13 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.