I would like to make a composed query using several logical operators.
I have the following tables: orders, clients, products
I want to create the following statement:
AND: AND: Client name is equal to "Smith" AND: Client age equal or grater than 18 AND: OR: Order quantity more that 2 OR: AND NOT: product material equal glass AND: product expire date greater than 2016
Having this statement, can you suggest me a way to construct this query in SQL using Arel?
My problem is how I can connect the AND and OR + AND NOT statement together.