Ms Access Sql Not Working As Desired
I have a query which goes like this. SELECT * FROM WHERE (Condition1) AND (Condition2 or Condition3) My desired result should be rows satisfying condition1 and ro
Solution 1:
In your comment you put:
SELECT*FROM<Database>WHERE
(
( [Title] Like'*Term1*'OR [Title] =''OR [Title] =''OR [Title] =''OR [Title] =''OR [Title] =''OR [Title] =''OR [Title] =''OR [Title] =''OR [Title] =''
)
and
(
( [Title] LIKE'*Term1*'OR'*Term3*'OR'*Indonesia*'or [Country] IN ('*India*','*Indonesia*')
)
)
)
Laid out like this you can see the structure a bit easier.
The biggest thing that is probably throwing you is the mix of LIKE
, OR
and IN
operators in the second part.
LIKE
is the only operator that can deal with wildcards, OR
and IN
can't.
You'd probably meant something like:
( [Title] LIKE'*Term1*'OR [Title] LIKE'*Term3*'OR [Title] LIKE'*Indonesia*'OR [Country] LIKE'*India*'OR [Country] LIKE'*Indonesia*'
)
instead.
Solution 2:
I'm not sure but, try this instead:
SELECT*FROM<database1>WHERE ((Condition1) AND (Condition2 or Condition3))
hope this will be solve your problem :)
Solution 3:
Wildcards are not used in IN
:
[Country] IN ('*India*','*Indonesia*')
doesn't mean what you think it means
Post a Comment for "Ms Access Sql Not Working As Desired"