This is the table i have.
And I need to select agains
select * from OfferCondition where Condition = '21'
This requires a HAVING clause for each condition AND the conditions in order (so it stops at the first one... apart from that does as you request I think...
SET @iValue = 21; SELECT substring_index(`Condition`,' ',1) AS Operator, substring_index(substring_index(`Condition`,' ',2 ),' ', -1) AS Value FROM OfferCondition HAVING (Operator = '>' AND @iValue > Value) OR (Operator = '>=' AND @iValue >= Value) OR (Operator = '=' AND @iValue = Value) LIMIT 1;
NOTE this also requires a space between the operator and operand - as pointed out elsewhere would be much better to include as separate columns