|
发表于 2010-10-13 18:21:37
|
显示全部楼层
本帖最后由 qi_ruo 于 2010-10-13 18:22 编辑
SELECT `risks`.*, `s`.`option_name` risk_status, `p`.`option_name` risk_potential, `i`.`option_name` risk_impact, `t`.`name` project_name, CONCAT_WS(", `"`, `c`.`last_name`, `c`.`first_name)` risk_assignedto FROM (`risks`) LEFT JOIN `options` as s ON `risks`.`status` = `s`.`option_id` and s.field = "risk_status" LEFT JOIN `options` as p ON `risks`.`potential` = `p`.`option_id` and p.field = "risk_potential" LEFT JOIN `options` as i ON `risks`.`impact` = `i`.`option_id` and i.field = "risk_impact" LEFT JOIN `contacts` as c ON `risks`.`assignedto` = `c`.`id` LEFT JOIN `projects` as t ON `risks`.`project_id` = `t`.`id`
CONCAT_WS(", `"`, `c`.`last_name`, `c`.`first_name)`这边出了点小问题
着急的话先加个false参数去掉反引号吧
不怕麻烦的话 自己手动加反引号也行 大家看看有什么方法
$this->db->select('risks.*, s.option_name risk_status, p.option_name risk_potential, i.option_name risk_impact, t.name project_name,CONCAT_WS(",", c.last_name, c.first_name ) risk_assignedto',false); |
|