Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $select = $this->_db->select()
- ->distinct()
- ->order(new Zend_Db_Expr('v.month, v.day asc'))
- ->group(array('v.month', 'v.day', 'v.domain'))
- ->join(array('e' => 'entities'), 'v.listing_id = e.guid', array())
- ->where('e.owner_guid = ?', $ownerGUID)
- ->from(array('v' => 'visit_tracker'), array(
- 'month', 'day', 'year', 'domain', 'count(v.id) as visits',
- 'leads' => new Zend_Db_Expr('('.
- $this->_db->select()
- ->from(array('l' => 'lead_entity'), 'count(l.guid)')
- ->joinInner(array('e' => 'entities'), 'l.guid = e.guid', array())
- ->where("from_unixtime(e.time_created, '%m') = v.month")
- ->where("from_unixtime(e.time_created, '%d') = v.day")
- ->where("l.guid = v.listing_id")
- .')')
- ));
Add Comment
Please, Sign In to add comment