0
我有這樣的SQL查詢:從原材料的SQL查詢的symfony 2 SQL查詢
SELECT * from gift WHERE NOW() >= `validbegin` AND NOW() <= `validend` ORDER BY `points`n ASC
我需要將其轉換爲一個Symfony的2查詢到的數據提取到一個對象調用禮品。到目前爲止,我有這樣的:
$query = $giftRepository->createQueryBuilder('p')
->where('NOW() >= validbegin AND NOW() <= p.validend')
->orderBy('p.points', 'ASC')
->getQuery();
$gifts = $query->getResult();
但是,這給了我:
[Syntax Error] line 0, col 53: Error: Expected known function, got 'NOW'
任何想法?
ps。也試過p.NOW()
什麼樣的領域是,日期時間? – mpm