anchor.diff:      {ok, Q} = get_query(
           "SELECT * FROM table1 "
           "WHERE a = 5 AND b >= 10 AND b > 10"),
  +    {ok, [S|_]} = compile(DDL, Q),
  +    ?assertPropsEqual(
  +        [{startkey,[{<<"a">>,timestamp,5}]},
  +         {endkey,  [{<<"a">>,timestamp,5}]},
  +         {filter, {'>',{field,<<"b">>,sint64},{const, 10}}},
  +         {end_inclusive,true}],
  +        S?SQL_SELECT.'WHERE'
  +    ).
  +
  +greater_than_is_less_than_previous_greater_than_or_equal_to_clause_removes_greater_than_or_equal_to_clause_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b > 9 AND b >= 10"),
       {ok, [S|_]} = compile(DDL, Q),
       ?assertPropsEqual(
           [{startkey,[{<<"a">>,timestamp,5}]},
  
positive.code:     ?assertPropsEqual(
          [{startkey,[{<<"a">>,timestamp,5}]},
           {endkey,  [{<<"a">>,timestamp,5}]},
           {filter, {'>=',{field,<<"b">>,sint64},{const, 10}}},
           {end_inclusive,true}],
          S?SQL_SELECT.'WHERE'
      ).
  
negative.code:             %% query like `a = 10 AND a > 8` we can eliminate the greater than
              %% clause because if a to be 10 it must also be greater than 8
              {eliminate, Acc};
          #filtercheck{'>=' = {_,_,{const,GteVal}} = F_x} = Check1 when GtVal >= GteVal ->
              %% query like `a >= 8 AND a > 10` we can eliminate the lesser clause
              %% because if the value must be greater than 10 it can't be 8 or 9.
              Check2 = Check1#filtercheck{'>' = F, '>=' = undefined},
              Acc2 = store_filter_check(Check2, Acc),
              Acc3 = append_to_eliminate_later(F_x, Acc2),
              {F,Acc3};
          #filtercheck{'>=' = {_,_,{const,GteVal}}} when GtVal < GteVal ->
              %% query like `b >= 10 AND b > 9`, the previous >= clause should be
              %% eliminated on the second pass
              {eliminate, Acc};
          #filtercheck{'>' = undefined} = Check1 ->
              %% this is the first greater than check so just record it
              Check2 = Check1#filtercheck{'>' = F},
              {F, lists:keystore(FieldName, #filtercheck.name, Acc, Check2)};
          #filtercheck{'>' = F_x} = Check1 when F_x < F ->
              %% eliminate the lower > value for this column
              Check2 = Check1#filtercheck{'>' = F},
              Acc2 = store_filter_check(Check2, Acc),
              Acc3 = append_to_eliminate_later(F_x, Acc2),
              {F,Acc3};
          #filtercheck{'>' = F_x} when F_x > F ->
              %% we already have a filter that is higher than this one, so
              %% eliminate
              {eliminate, Acc}
      end;
  check_where_clause_is_possible_fold(_, _, {'>=',{field,FieldName,_},{const,GteVal}} = F, Acc) ->
      case find_filter_check(FieldName, Acc) of
  