4

嗨,我想在 zend 框架 dbclass 中创建这个 sql

selec * from table where type = 2 AND (name LIKE '%4%' OR name LIKE '%5%')

我怎么能用zend where 和 orwhere 做到这一点?

使用普通模式将生成此 sql

 $this->select()->from($this->_name)->where('type = ?', $type)->orwhere('name LIKE ?', '%'.4.'%');

这不是我需要的

我也认为在这种情况下我可以使用有,这是个好主意吗?

4

1 回答 1

9

你要:

$this->select()
     ->from($this->_name)
     ->where('type = ?', $type)
     ->where('name LIKE ? OR name LIKE ?', array('%'.4.'%', '%'.5.'%');
于 2013-05-16T08:35:42.637 回答