date comparation / Help Please!

date comparation

i have two column data and valabilitate( both sate as date type ) in my database, I want to compare like this:



public static function cautaToateAnunturile($sort, $dir, $page_number) {    
                        //$page_number = fRequest::get('page','integer');
                        //if (empty($page_number)) $page_number = 1; 
                        
                return fRecordSet::build(__CLASS__,array('data<' => 'valabilitate','activ=' => '1'), array($sort => $dir),PER_PAGE,$page_number);
            }


mysql query output looks like this:

SELECT anunturi.* FROM anunturi WHERE anunturi.data < NULL AND anunturi.activ = TRUE ORDER BY LOWER(anunturi.text) DESC LIMIT 10 OFFSET 0


it's a bug or maybe i didn't do something corectly.


  • Message #462

    Currently there is no way to compare two columns in fRecordSet::build(), mostly because I have not thought of a good syntax for it. The reason the SQL statement is showing NULL is because it was unable to convert the string 'valabilitate' to a date.

    To do this query, you'll need to use fRecordSet::buildFromSQL(). You should be able to copy the generated SQL statement and change NULL to valabilitate.