Php 使用带子字符串的where推进

Php 使用带子字符串的where推进,php,sql,propel,Php,Sql,Propel,为什么这不起作用 $allRecords = RecordsQuery::create() ->where('SUBSTR(Records.paymentTime, 1, 7) = ?', '2013-02') ->findOne(); // var_dump($allRecords); 它只返回null。 如果我使用这个assql命令,它将返回正确的记录 Records.paymentTime是一个日期字段 其次。记录的数据类型是什么。paymenttime?您可以尝试查看实际运

为什么这不起作用

$allRecords = RecordsQuery::create()
->where('SUBSTR(Records.paymentTime, 1, 7) = ?', '2013-02')
->findOne(); //
var_dump($allRecords);
它只返回null。 如果我使用这个assql命令,它将返回正确的记录

Records.paymentTime是一个日期字段


其次。

记录的数据类型是什么。paymenttime?您可以尝试查看实际运行的SQL查询:
echo RecordsQuery::create()->where('SUBSTR(records.paymenttime,1,7)=?','2013-02')->toString()带有toString的uotput是我想要的。奇怪的是,它没有找回我想要的东西。此外,我不能像这样将toString的输出复制到例如phpMyAdmin中,我需要添加我想要检索的单元格。输出类似这样的内容:从tablename,其中SUBSTR(payment_time,1,7)=XXX我需要这样的输出:SELECT*FROM[…]