[英]Zend - Selecting a specific field
我正在嘗試查詢數據庫以查找表中一個特定字段的結果。 從我完成的所有研究中,以下代碼應僅返回“ id_maquina”字段,但實際上返回的是所有字段。
$hist_select=$historico->select()
->setIntegrityCheck(false)
->from(array('t1'=>'maquina_cafe'),array('t1.id_maquina'))
->joinLeft(array('t2'=>'maquinas'),'t1.id_maquina=t2.ID')
->where('t1.username = ?',$identity);
我在from方法中添加了* array('t1.id_maquina')*,以按照我在stackoverflow上的帖子中的指示將其指定為我想要的字段,但是它不起作用。 有人對此有何想法?
您使用哪個Zend版本?
您選擇聯接表中的所有列,因為聯接的默認值為“ *”(所有列)。
嘗試:
$hist_select=$historico->select()
->setIntegrityCheck(false)
->from(array('t1'=>'maquina_cafe'),array('t1.id_maquina'))
->joinLeft(array('t2'=>'maquinas'),'t1.id_maquina=t2.ID', array())
->where('t1.username = ?',$identity);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.