brick icon indicating copy to clipboard operation
brick copied to clipboard

Getting right a query with OR and nested AND

Open stefanorumi7 opened this issue 2 months ago • 2 comments

Hey peepz, I am using brick + supabase and I am trying to get a query to work and I can't:

I have a query of the type

SELECT *
FROM entityA
WHERE columnA != 'valueA' 
   OR (columnA IS NULL AND columnB = false)

I tried the following

WherePhrase _getCondition() {
    return WherePhrase([
      const Or('columnA').isNot('valueA'),
      const WherePhrase([
        Where.exact('columnA', null),
        Where.exact('columnB', false),
      ]),
    ]);
  }

And some similar variations.

Anyone has suggestions?

stefanorumi7 avatar Nov 06 '25 08:11 stefanorumi7