... and codeID NOT LIKE 'ST%' ...
May be a solution.
Or if S1, S2, S3 is up to S9 but not S10, you can use and codeID LIKE 'S_'
But if possible the rigth way is to rewrite this code so any code isn't the start for any other code.
For example adding a starting letter:
AS1, AS2, AS3, ...
BST1, BST2, BST3, ...
CSR1, CSR2, CSR3, ...
Or adding a char after the S:
SS1, SS2, SS3, ...
ST1, ST2, ST3, ...
SR1, SR2, SR3, ...
Or if the code are just three don't use the like:
and (codeID= "S1" OR codeID= "S2" OR codeID= "S3")
I hope this helps you.