Let's come in and see how this sql function is optimized.

CREATE DEFINER=`root`@`%` FUNCTION `is_mixed`(str1 TEXT, str2 TEXT) RETURNS tinyint(4)
BEGIN
    DECLARE ismixed TINYINT DEFAULT 0;
    set ismixed:=(select concat(str1, ",") regexp concat(replace(str2,",",",|"), ","));
    RETURN ismixed;
    END

call:

select is_mixed("11,13","11,12,14,15,16")

result: 1

Sep.07,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e82df7-469d4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e82df7-469d4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?