2014-09-06 58 views
0

3框架并想做简单的sql。我有这样的功能,但问题是,我输出 “SELECT listings。* FROM listings WHERE listings_id ='1'LIMIT'1'”我不想在第一个列表后选择我想要所有的列。Zend 2 sql查询问题

static $tableName = 'listings'; 

public function getListingsById($id){ 

    $select = new Select(); 
    $select->from(self::$tableName); 
    $where = new Where(); 
    $where->equalTo('listings_id', $id); 
    $select->where($where); 
    $select->limit(1); 

    echo $select->getSqlString($this->getAdapter()->getPlatform()); 
    return $this->selectWith($select); 
} 

回答

0

SELECT listings.* FROM listings相同SELECT * FROM listings - 既会给你一切从表中的列。