[rt-devel] SearchBuilder DISTINCTs

Matt Knopp mhat at netlag.com
Thu Feb 20 13:17:05 EST 2003


Dude! It's like rocket surgery! No really! Add a LimitDistinctP() method to 
SearchBuilder which sets an instance variable, say 'UseDistinctP'. Then in 
_DoSearch change: 

  $QueryString = 
    "SELECT DISTINCT main.* FROM " . $self->_TableAliases . " "; 

To something like: 

  $QueryString = 
    "SELECT " . ($this->{'UseDistinctP'} ? "DISTINCT" : "") .
    " main.* from " . $self->_TableAliases . " "; 

Sure, it requires the SB user to know that they want distinct values, but 
really that's okay. It's worse to force distinct values on someone who may
not have expected it. 

-Matt




More information about the Rt-devel mailing list