Hi, I have a doubt in MS SQL, The below condition in the WHERE clause as you can see,
"Where COTDetails NOT BETWEEN 32 AND 63 OR COTDetails is NULL",
I want to the WHERE clause in such a way that the COTDetails is not between 32 and 63 and also is NULL, OR condition does not satisfy my condition.
Any help appreciated

Have a look at this Click Here.

Also do WANT to select COTDetails that are NULL or that are NOT NULL ?

i shall make my question more clearer, say my COTDetails has values from NULL, 1...... 100, i want to leave data that is not between 32 and 63, everything else, including null should be considered, but in my query, wen i use not between 32 and 63 , i do not get null values in the result.

Is COTDetails a column in a table ? if so do the following for where clause:

WHERE COTDetails NOT BETWEEN '32' AND '63';

This works for me when selecting customers using their ID column.

Also don't forget to put " " on each end of your SQL statement.

"Where COTDetails NOT BETWEEN 32 AND 63 OR COTDetails is NULL" is working fine,
@ChrisHunter : the query which you gave will not result the null values, but I wanted null values as well. Thank you.

Glad i . . . kind of helped.

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.