dtpk04526211 2013-07-26 13:09
浏览 15

symfony 1.4一个结果是学说,但为什么呢?

If I shoot this query in pgsql i get 228 results

SELECT MIN(p.article_id) AS p__0 FROM property p INNER JOIN article a ON p.article_id = a.id AND (a.is_active = true) WHERE (p.name LIKE 'hotel_number') GROUP BY p.string_value

But if i shoot it in doctrine symfony 1.4

$numbers = $this->createQuery('p')->addselect('min(p.article_id) as article_id')->where('p.name LIKE ?', 'hotel_number')->innerJoin('p.Article a')->groupBy('p.string_value')->execute();

result like:

1021

Anyone know why?

EDIT: i tryed to fix it over a longer way to match first all "string_values"

and make them a new query its slower but i thought it would work..

Now i got a array of string_values (int / list) and wana query them with this:

Doctrine_Query::create()->select('min(a.id) as id')->from('Article a')->innerJoin('a.Properties p')->andWhereIn('p.string_value', $test)->groupBy('p.string_value')->execute();

If I copy query from dev toolbar i got this :

SELECT MIN(a.id) AS a__0 FROM article a INNER JOIN property p ON a.id = p.article_id WHERE (p.string_value IN ('131', '2', '254', '2911', '135', '362', '413', '1392', '439', '156', '303', '287', '1526', '3713', '149', '383', '3505', '1441', '433', '367', '175', '3921', '20471', '2514', '3507', '1079', '317', '2852', '427', '145', '3770', '46496', '46451', '452', '178', '280', '28775', '432', '3842', '1182', '46448', '3496', '486', '359', '46447', '3486', '2963', '2969', '3460', '501', '357', '45406', '3021', '325', '160', '426', '1417', '46516', '1290', '46503', '3503', '140', '416', '3908', '1389', '371', '442', '3841', '2519', '46420', '177', '273', '3907', '3909', '229', '293', '331', '250', '151', '46485', '3435', '46527', '1442', '382', '155', '3840', '3458', '3885', '126', '80543', '533', '418', '445', '346', '698', '139', '415', '405', '406', '358', '270', '167', '365', '379', '199', '2867', '2559', '3479', '3829', '118', '283', '328', '110', '46450', '127', '3006', '431', '132', '356', '3495', '3485', '3643', '46508', '249', '45404', '1451', '45403', '476', '2983', '3886', '1418', '80542', '2529', '3428', '419', '2000', '3500', '3009', '116', '5000', '3800', '176', '3639', '339', '414', '3637', '421', '174', '372', '288', '3894', '3502', '46513', '487', '1164', '2566', '261', '412', '354', '316', '46493', '404', '285', '403', '2513', '124', '3011', '2684', '3506', '46528', '105', '3450', '46475', '290', '417', '3459', '246', '3831', '395', '46502', '28795', '162', '3482', '291', '435', '422', '234', '163', '443', '311', '504', '166', '46472', '45398', '247', '125', '46500', '46469', '507', '326', '20468', '388', '1523', '320', '363', '370', '272', '183', '111', '134', '242', '80537', '430', '239', '277', '1090', '3712', '3499', '281', '319', '534', '248', '3480', '407', '3676', '141', '1532', '20470', '2527', '451', '327', '3018', '429', '538', '366', '457', '321', '3900', '441', '80540', '615', '46495', '282', '399', '531', '3899', '1381', '3635', '3004', '3834', '438', '526', '3434', '286', '3607', '296', '440', '1', '257', '138', '428', '3833', '546', '446', '169', '355', '3896', '351', '528', '3504', '1382', '3737', '46449', '377', '3488', '207', '436', '200') AND (a.is_active = true)) GROUP BY p.string_value

if i fire the query in sql i got 170 results and in symfony i got just one value .. how can it be?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 软件测试决策法疑问求解答
    • ¥15 win11 23H2删除推荐的项目,支持注册表等
    • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
    • ¥15 qt6.6.3 基于百度云的语音识别 不会改
    • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
    • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
    • ¥15 lingo18勾选global solver求解使用的算法
    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
    • ¥20 测距传感器数据手册i2c