Reply to comment

Subselects im Zend Framework - Zend DB

Ich bin sicher nicht der erste der sich fragt, wie Subselects im Zend Framework gelöst sind!

Hier also eine kleine Anleitung zu Zend DB - Subselects:

  1. $subselect = $this->_db->select()
  2. ->from('A')
  3. ->where('x=?', $x)
  4.  
  5. $select = $this->_db->select()
  6. ->from(array('t1' => $subselect), array('id' => 't1.id', 'name' => 't1.name', 'date' => 't1.date'))
  7. ->joinLeft(array('t2' => 'abc'), 't2.project_id=t1.id', array('xyz' => 't2.id'))
  8. ->where('t2.type=?', $y)
  9. ->order(array('t1.sort ASC', 't2.sort ASC'));
  10.  
  11. $rows = $this->_db->fetchAll($select);

Trackback URL for this post:

http://julian.pustkuchen.com/en/trackback/101

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><blockquote>
  • Lines and paragraphs break automatically.
  • Pairs of<blockquote> tags will be styled as a block that indicates a quotation.
  • You can enable syntax highlighting of source code with the following tags: <c>, <cpp>, <css>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <php>, <python>, <ruby>, <smarty>, <xml>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.