anchor.diff:      end;
   check_where_clause_is_possible_fold(_, _, {'>',{field,FieldName,_},_} = F, Acc) ->
       case find_filter_check(FieldName, Acc) of
  -        #filtercheck{'=' = F} ->
  +        #filtercheck{'>' = F} ->
               %% this filter has been specified twice so remove the second occurence
               {eliminate, Acc};
  -        #filtercheck{'=' = undefined} = Check1 ->
  +        #filtercheck{'>' = undefined} = Check1 ->
               %% this is the first equality check so just record it
  -            Check2 = Check1#filtercheck{'=' = F},
  +            Check2 = Check1#filtercheck{'>' = F},
               {F, lists:keystore(FieldName, #filtercheck.name, Acc, Check2)};
  -        #filtercheck{'=' = F_x} when F_x < F ->
  +        #filtercheck{'>' = F_x} when F_x < F ->
               %% we already have a filter that is a lower value than 
  -            {eliminate, Acc}
  +            {eliminate, Acc};
  +        #filtercheck{'>' = F_x} = Check1 when F_x > F ->
  +            %% we already have a filter that is higher than the second one,
  +            %% which we can eliminate. Store it and eliminate it on the second
  +            %% pass since it has already been iterated
  +            Check2 = Check1#filtercheck{'>' = F},
  +            Acc2 = lists:keystore(FieldName, #filtercheck.name, Acc, Check2),
  +            Acc3 = append_to_eliminate_later(F_x, Acc2),
  +            {F, Acc3}
       end;
   check_where_clause_is_possible_fold(_, _, Filter, Acc) ->
       {Filter, Acc}.
  +
  +append_to_eliminate_later(Filter, Acc) ->
  +    ElimLater = proplists:get_value(eliminate_later, Acc),
  +    lists:keystore(eliminate_later, 1, Acc, {eliminate_later, [Filter|ElimLater]}).
   
   %% TODO put this in the table helper module
   is_field_nullable(FieldName, ?DDL{fields = Fields}) when is_binary(FieldName)->
  
positive.code:         S?SQL_SELECT.'WHERE'
      ).
  
  -endif.
  
negative.code:     ).
  
  
  second_greater_than_check_which_is_a_greater_value_is_removed_test() ->
      DDL = get_ddl(
          "CREATE TABLE table1("
          "a TIMESTAMP NOT NULL, "
  