Combining AND with OR in Database Query

Hello! :+1:

How can I combine AND with OR queries in the Wappler database query builder?
I checked the Docs but it seems like that was an older version that was different.

I’d like to say, find all the database records where:
(A1 = A2) OR (A1 = null AND A2 = null)

Want more details?
I’m looking for duplicate addresses in my database. I want to be able to say:
Select PropertyID From CustomerAddresses WHERE…
City1 = City2
Zip1 = Zip2
Street1 = Street2
PrimaryNumber1 = PrimaryNumber2
SecondNumber1 = SecondNumber2
etc.

But, sometimes values will be null. Particularly the Second Number in the address. So, if I do
SecondNumber1 = SecondNumber2
it will return false instead of true when they are both null.
So I need to be able to say:

WHERE
(SecondNumber1 = SecondNumber2) OR (SecondNumber1 = null AND SecondNumber2 = null).

But I’m not sure how to accomplish that in the query builder.
THANKS!
Jeff

Community Page
Last updated: