Today in the debugger, need to use and OR, if not mastering the skills output of the structure and we think that the gap is a bit large, here to share, I hope you will support the cloud Habitat community
Can and and or are not used concurrently in an ASP's SQL statement?
The answer is yes, let's look at the following method:
1, very responsible to tell you, can be used at the same time. But look at the business requirements
2, the use of the scene for example:
Query Table male students born in 2000 and 2002
SELECT * FROM student table where sex = ' male ' and (year of birth =2000 or year of birth =2002)
3, in fact, or can be replaced with SQL in, so that writing will be more convenient
For example, the above example is written in:
SELECT * FROM student table where sex = ' man ' and year of birth in (2000,2002)
In fact, it is through () to the need to pay attention to the place, expand the
For example: Cloud Habitat Community Background search, need to judge when the search is JS, then some of our editors use JavaScript, then some things can not search, then you can refer to this method
Core code:
Select Case LCase (Keyarr (i)) case
"JS"
sqlk=sqlk& "and (title like '%" &keyarr (i) & '% ' or title like '% javascript% ') "Case
" JavaScript "
sqlk=sqlk&" and (title like '% "&keyarr (I) &"% "or title like '%js% ' "Case
" C # "
sqlk=sqlk&" and (title like '% "&keyarr (I) & '% ' or title like '%csharp% ')" Case
" CSharp "
sqlk=sqlk&" and (title like '% "&keyarr (I) &"% ' or title like '%c#% ') "Case
else
sqlk= sqlk& "and title like '%" &keyarr (I) & "%" ""