Is there no way you can tell if the user is searching for code1 or code2 or code1.code2?
If there never is a dot in either of the codes then you can at least tell that someone is looking for code1.code2 if there is a dot. Then I think this would work:
// If there is no dot in search term
WHERE code1 LIKE '$search' or code2 LIKE '$search'
// If there is a dot in search term, split search
WHERE code1 LIKE '$firstPartOfSearch' AND code2 LIKE '$lastPartOfSearch'
You can define CONCAT AS test and then have HAVING (not WHERE) test LIKE ‘%$trimm%’. However doing it like that would force the dbms to do concat on each and every row in the table. No index can be used. So basically it will be really slow for large tables.
If you always search for code1.code2 (like 1002.5660) then I would recommend splitting the search term in php and then running a query like:
WHERE code1 = '$firstPartOfSearchWord' and code2 = '$secondPartOfSearchWord'