SET @CLINIC_ID = CONCAT(@ctryID,@statID, UCASE(LEFT(@clncCity,2)), IF(ISNULL(MAX(clinics.clnc_ID)), '01', LPAD((RIGHT(MAX(clinics.clnc_ID),2)+1),2,'0')));
Put the above text in the editor. Put the cursor at the end. Ctrl+F and search for clnc. Wont find. Put the cursor at the beginning and do the same. Finds it.