将mysql查询转换为codeigniter查询
当前查询:
$query = "SELECT a.*, b.cost AS future_cost, b.start_date AS future_date
FROM (
SELECT * FROM (
SELECT * FROM outbound_routes
ORDER BY start_date
) x
GROUP BY pattern
) a
LEFT JOIN (
SELECT * FROM outbound_routes
ORDER BY start_date
) b
ON a.pattern = b.pattern AND a.id != b.id
GROUP BY a.pattern";
$result=$this->db->query($query);
在粗体查询中,我想附加搜索变量,例如
$this->db->where('pattern','1');
任何帮助和想法将不胜感激。