Hi All,

SELECT * FROM Results WHERE ActualValue NOT BETWEEN Lowerimit AND UpperLimit

In my query ActualValue is VARCHAR field. How can I get Results that are out of limit?

Shrinivas

Recommended Answers

All 3 Replies

It looks you have some alpha numeric upper and lower limits. You can look for the pattern of data to create a string and pass it to the query. Another way is to re-phrase the query but I am not too sure of the data and table size. If you can provide some more details I can try and look at it.

It looks you have some alpha numeric upper and lower limits. You can look for the pattern of data to create a string and pass it to the query. Another way is to re-phrase the query but I am not too sure of the data and table size. If you can provide some more details I can try and look at it.

Thanks for reply.
I did it this way:

SELECT * FROM Results
WHERE STID=111 AND (CASE WHEN (ISNUMERIC(ActualValue)=1) THEN CAST(ActualValue AS FLOAT) ELSE 0 END) NOT BETWEEN LowerLimit AND HigherLimit

Just curious, how many records are selected out of this query from the total.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.