I want to calculate a boolean expression like this
((('a' or 'b') AND ('c' or 'd') AND ('e' or 'f')) IN (SELECT COLUMN1 FROM...))
(‘a’, ‘b’… are all strings)
Of course if I write a query like that, SQL Server will throw error because ‘a’, ‘b’… are not boolean type.
Can anyone help me to write a shorter query to calculate that expression than below one:
((('a' in (select..)) or (('b' in (select...)))
AND ((('c' in (select..)) or (('d' in (select...)))
AND ((('e' in (select..)) or (('f' in (select...)))
Thanks.
`EDIT: add more infor about my query`
This is my query (of course it didnot work)
SELECT ID, Name, Addr, PhoneNumber, Descr FROM CusInfo
WHERE Type_ID = 'type_01'
AND `((('a' or 'b') AND ('c' or 'd') AND ( 'e' or 'f')) IN (SELECT Cri_ID FROM CusCri WHERE CusCri.Cus_ID = CusInfo.ID))`
All I want is to calculate (('a' or 'b') AND ('c' or 'd') AND ( 'e' or 'f')) IN (SELECT Cri_ID FROM CusCri WHERE CusCri.Cus_ID = CusInfo.ID) as a boolean.
Try (updated, following amended question):