We are trying to select all rows from a table where a specific field has a value that is contained inside an array of values - e.g.
SELECT * FROM table WHERE field IN(array)
The specific use is seeing if the field contains a specific User Group from an array of provided User Groups that the user currently belongs to - e.g.
SELECT * FROM Gadgets WHERE Visibility IN("Everyone", "Registered User", "Site Owner", "Accountant")
Coming up blank on all our searches, so would love some help on this one.
With a bit more digging we found ARRAY_CONTAINS, which would probably be a better answer to the original question - even though we did end up using EXISTS and referencing another table.
We thought it best to throw it in here for anyone else searching on this topic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With