尝试使用复制以下查询Zend_Db_Select
。有什么指点吗?
SELECT
compounds.id as compounds_id,
reactions.id as reactions_id,
reaction_compound.number as reaction_compound_number
FROM compounds, reactions, reaction_compound
WHERE
compounds.id IN (68,74,112)
AND compounds.id = reaction_compound.compound
AND reactions.id = reaction_compound.reaction;
具体来说,我遇到的一些问题是在 Zend 中进行多个表连接。我不确定如何使用查询生成器跨多个表进行联接。
任何帮助表示赞赏!
J
喜欢的东西:
$compoundIds = array(68,74,112);
$select = $db->select()
->from('compounds', array('compounds_id' => 'id')
->where('compounds.id in ( ? )', $compoundIds)
->join('reaction_compound', 'compounds.id = reaction_compound.compound', array('reaction_compound_number' => 'number'))
->join('reactions', 'reactions.id = reaction_compound.reaction', array('reaction_id' => 'id');
那应该能让你到达某个地方。我没有测试过,所以里面可能有一些错误。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)