Table1
Items Qty
Item A 1
Item B 5
Item C 3
Item D 7
Item E 1
Item F 2
Item G 10
Item H 1
Item I 8
I need to write a statement like:
Declare @selection int = (can be 0, 1, or 2)
Select Items, Qty From Table1
Where
CASE
-- when @selection = 0, select all items
-- when @selection = 1, select items that have qty = 1
-- when @selection = 2, select items that have qty > 1
END
Of course, most waiters would confirm the order. If given a choice, they'd simply bring the highest-priced combo. Now what if I asked for "fries and burger or hash browns" ? even more ambiguous. we tend to group things according to categories (fries and hash browns are both potatoes) and good AI can do the same.
Anyway I advocate removing parentheses around ANDed items. Since (burger and fries) means the same as "burger and fries" both to you and SQL (precedence). However, what I suppose you wanted is "burger and (fries or hash browns)" and you certainly do need the parentheses around the ORed items. Both for people and machines!