Guest User

Untitled

a guest
Jan 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php
  2.  
  3. $select = $this->_db->select()
  4. ->distinct()
  5. ->order(new Zend_Db_Expr('v.month, v.day asc'))
  6. ->group(array('v.month', 'v.day', 'v.domain'))
  7. ->join(array('e' => 'entities'), 'v.listing_id = e.guid', array())
  8. ->where('e.owner_guid = ?', $ownerGUID)
  9. ->from(array('v' => 'visit_tracker'), array(
  10. 'month', 'day', 'year', 'domain', 'count(v.id) as visits',
  11. 'leads' => new Zend_Db_Expr('('.
  12. $this->_db->select()
  13. ->from(array('l' => 'lead_entity'), 'count(l.guid)')
  14. ->joinInner(array('e' => 'entities'), 'l.guid = e.guid', array())
  15. ->where("from_unixtime(e.time_created, '%m') = v.month")
  16. ->where("from_unixtime(e.time_created, '%d') = v.day")
  17. ->where("l.guid = v.listing_id")
  18. .')')
  19. ));
Add Comment
Please, Sign In to add comment