-1
我試圖創建一個使用標準,推進了如下聲明:的Propel標準
AND unix_timestamp(table.last_action) > unix_timestamp(table.last_action) -1800
但我似乎並沒有能夠得到它的權利
$kriterien->add(sfGuardUserProfilePeer::LAST_ACTION, 'unix_timestamp(table.last_action)-90', Criteria::GREATER_THEN);
sfGuardUserProfilePeer::LAST_ACTION
不是UNIX_TIMESTAMP。我如何改變它以便它?我已經嘗試只更改BasesGuardUserProfilePeer.php
中的LAST_ACTION
的值,但它引發了錯誤。
你爲什麼要這麼做?由於您不必要地應用函數,數據庫將無法使用任何索引來解決這部分查詢;您不需要使用UNIX時間戳修改日期。 '東西>東西 - INTERVAL 1800 SECOND'。當然,你的查詢是沒有意義的,因爲列不能大於自身... –
什麼? :-) 查詢完美無缺 東西>東西 - 1800秒是現在和半小時之前的所有東西 – ldrocks
不,每件東西都是1800'。所有的數字都大於他們自己減去其他數字。從現在到半小時前,「CURRENT_TIMESTAMP - 1800」將是每一行。 –