开发者

ms-access: proper syntax for a long condition statement

here's my condition:

([Panels] like '*something*' or [Pane开发者_JAVA技巧ls] like '*something1*') AND ([Panels] like '*something2*' or [Panels] like '*something3*')

another words, here is the logic:

[Panels] has to be one of the following (IT_AMPH | AMPH_SN | AMPH_S) AND it has to be one of the following: (IT_BARB | BARB_SN | BARB_S)


Try using In

[Panels] In ('IT_AMPH','AMPH_SN ','AMPH_S')
AND [Panels] In ('IT_BARB','BARB_SN','BARB_S')

This will return True if [Panels] is in both lists.

If you want to use exclusively and and or... well, it can be a real headache:

([Panels]='IT_AMPH' AND [Panels]='AMPH_SN ' AND [Panels]='AMPH_S')
OR ([Panels]='IT_BARB' AND [Panels]='BARB_SN' AND [Panels]='BARB_S')

Hope this helps you.


If you need to use wildcards, you can replace the = with Like:

([Panels] Like '*IT_AMPH*' AND [Panels] Like '*AMPH_SN*' AND [Panels] Like '*AMPH_S*')
OR ([Panels] Like '*IT_BARB*' AND [Panels] Like '*BARB_SN*' AND [Panels] Like '*BARB_S*')

Hope this helps you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜